chore: added proper lints and fixed some warnings
- reapplied plugin template
This commit is contained in:
parent
f5b0e34a3b
commit
dec10b2a83
7 changed files with 49 additions and 12 deletions
24
.metadata
24
.metadata
|
@ -1,10 +1,30 @@
|
||||||
# This file tracks properties of this Flutter project.
|
# This file tracks properties of this Flutter project.
|
||||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
# 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:
|
version:
|
||||||
revision: adc687823a831bbebe28bdccfac1a628ca621513
|
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
project_type: plugin
|
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
analysis_options.yaml
Normal file
15
analysis_options.yaml
Normal file
|
@ -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
|
|
@ -4,12 +4,14 @@ import 'package:flutter/material.dart' hide Intent;
|
||||||
import 'package:receive_intent/receive_intent.dart';
|
import 'package:receive_intent/receive_intent.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
|
const MyApp({Key key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MyAppState createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp> {
|
class _MyAppState extends State<MyApp> {
|
||||||
|
|
|
@ -27,6 +27,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_lints: ^2.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
|
@ -7,19 +7,18 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'package:receive_intent_example/main.dart';
|
import 'package:receive_intent_example/main.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(MyApp());
|
await tester.pumpWidget(const MyApp());
|
||||||
|
|
||||||
// Verify that platform version is retrieved.
|
// Verify that platform version is retrieved.
|
||||||
expect(
|
expect(
|
||||||
find.byWidgetPredicate(
|
find.byWidgetPredicate(
|
||||||
(Widget widget) => widget is Text &&
|
(Widget widget) =>
|
||||||
widget.data.startsWith('Running on:'),
|
widget is Text && widget.data.startsWith('Running on:'),
|
||||||
),
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
|
|
|
@ -64,10 +64,9 @@ class Intent {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReceiveIntent {
|
class ReceiveIntent {
|
||||||
static const MethodChannel _methodChannel =
|
static const MethodChannel _methodChannel = MethodChannel('receive_intent');
|
||||||
const MethodChannel('receive_intent');
|
|
||||||
static const EventChannel _eventChannel =
|
static const EventChannel _eventChannel =
|
||||||
const EventChannel("receive_intent/event");
|
EventChannel("receive_intent/event");
|
||||||
|
|
||||||
static Future<Intent?> getInitialIntent() async {
|
static Future<Intent?> getInitialIntent() async {
|
||||||
final renameMap = await _methodChannel.invokeMapMethod('getInitialIntent');
|
final renameMap = await _methodChannel.invokeMapMethod('getInitialIntent');
|
||||||
|
@ -80,7 +79,7 @@ class ReceiveIntent {
|
||||||
.map<Intent?>((event) => Intent.fromMap(event as Map?));
|
.map<Intent?>((event) => Intent.fromMap(event as Map?));
|
||||||
|
|
||||||
static Future<void> setResult(int resultCode,
|
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>{
|
await _methodChannel.invokeMethod('setResult', <String, dynamic>{
|
||||||
"resultCode": resultCode,
|
"resultCode": resultCode,
|
||||||
if (data != null) "data": json.encode(data),
|
if (data != null) "data": json.encode(data),
|
||||||
|
|
|
@ -14,6 +14,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_lints: ^2.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
Loading…
Reference in a new issue