Skip to content

Commit

Permalink
chore: added proper lints and fixed some warnings
Browse files Browse the repository at this point in the history
  - reapplied plugin template
  • Loading branch information
daadu committed Jul 20, 2022
1 parent f5b0e34 commit dec10b2
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 12 deletions.
24 changes: 22 additions & 2 deletions .metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: adc687823a831bbebe28bdccfac1a628ca621513
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
channel: stable

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
- platform: android
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
15 changes: 15 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
# doc-style related: https://dart.dev/guides/language/effective-dart/documentation
- package_api_docs
- public_member_api_docs
- comment_references
- slash_for_doc_comments
# pub related: https://dart.dev/tools/linter-rules#pub-rules
- depend_on_referenced_packages
- secure_pubspec_urls
# import related
- always_use_package_imports
- implementation_imports
6 changes: 4 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import 'package:flutter/material.dart' hide Intent;
import 'package:receive_intent/receive_intent.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatefulWidget {
const MyApp({Key key}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
Expand Down
1 change: 1 addition & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
7 changes: 3 additions & 4 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:receive_intent_example/main.dart';

void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
await tester.pumpWidget(const MyApp());

// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
(Widget widget) =>
widget is Text && widget.data.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
7 changes: 3 additions & 4 deletions lib/receive_intent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ class Intent {
}

class ReceiveIntent {
static const MethodChannel _methodChannel =
const MethodChannel('receive_intent');
static const MethodChannel _methodChannel = MethodChannel('receive_intent');
static const EventChannel _eventChannel =
const EventChannel("receive_intent/event");
EventChannel("receive_intent/event");

static Future<Intent?> getInitialIntent() async {
final renameMap = await _methodChannel.invokeMapMethod('getInitialIntent');
Expand All @@ -80,7 +79,7 @@ class ReceiveIntent {
.map<Intent?>((event) => Intent.fromMap(event as Map?));

static Future<void> setResult(int resultCode,
{Map<String, Object?>? data, bool shouldFinish: false}) async {
{Map<String, Object?>? data, bool shouldFinish = false}) async {
await _methodChannel.invokeMethod('setResult', <String, dynamic>{
"resultCode": resultCode,
if (data != null) "data": json.encode(data),
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down

0 comments on commit dec10b2

Please sign in to comment.