diff --git a/ios_app_clip/analysis_options.yaml b/ios_app_clip/analysis_options.yaml new file mode 100644 index 000000000..85f6fbe91 --- /dev/null +++ b/ios_app_clip/analysis_options.yaml @@ -0,0 +1,19 @@ +include: package:flutter_lints/flutter.yaml + +analyzer: + strong-mode: + implicit-casts: false + implicit-dynamic: false + +linter: + rules: + avoid_types_on_closure_parameters: true + avoid_void_async: true + cancel_subscriptions: true + close_sinks: true + directives_ordering: true + package_api_docs: true + package_prefixed_library_names: true + test_types_in_equals: true + throw_in_finally: true + unnecessary_statements: true diff --git a/ios_app_clip/lib/main.dart b/ios_app_clip/lib/main.dart index a6ba3a8bc..0dce049fb 100644 --- a/ios_app_clip/lib/main.dart +++ b/ios_app_clip/lib/main.dart @@ -7,12 +7,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; void main() { - runApp(Demo()); + runApp(const Demo()); } // The same content is shown for both the main app target and in the App // Clip. class Demo extends StatefulWidget { + const Demo({Key key}) : super(key: key); + @override State createState() => _DemoState(); } @@ -22,7 +24,7 @@ class _DemoState extends State { @override void initState() { - DeviceInfoPlugin().iosInfo.then((IosDeviceInfo info) { + DeviceInfoPlugin().iosInfo.then((info) { setState(() { deviceInfo = '${info.name} on ${info.systemName} version ' '${info.systemVersion}'; @@ -35,7 +37,7 @@ class _DemoState extends State { Widget build(BuildContext context) { return CupertinoApp( home: CupertinoPageScaffold( - navigationBar: CupertinoNavigationBar( + navigationBar: const CupertinoNavigationBar( middle: Text('App Clip'), ), child: Center( @@ -43,8 +45,8 @@ class _DemoState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text(deviceInfo), - Padding(padding: EdgeInsets.only(top: 18)), - FlutterLogo(size: 128), + const Padding(padding: EdgeInsets.only(top: 18)), + const FlutterLogo(size: 128), ], ), ), diff --git a/ios_app_clip/pubspec.lock b/ios_app_clip/pubspec.lock index 5905d8ee5..5fbe06923 100644 --- a/ios_app_clip/pubspec.lock +++ b/ios_app_clip/pubspec.lock @@ -76,11 +76,25 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" matcher: dependency: transitive description: diff --git a/ios_app_clip/pubspec.yaml b/ios_app_clip/pubspec.yaml index e5787b5d5..34359fce1 100644 --- a/ios_app_clip/pubspec.yaml +++ b/ios_app_clip/pubspec.yaml @@ -1,7 +1,7 @@ name: ios_app_clip description: An example Flutter project that can build as an App Clip. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 @@ -13,10 +13,11 @@ dependencies: sdk: flutter cupertino_icons: ^1.0.0 - device_info: '>=0.4.2+7 <2.0.0' + device_info: ">=0.4.2+7 <2.0.0" dev_dependencies: flutter_test: sdk: flutter + flutter_lints: ^1.0.0 flutter: diff --git a/ios_app_clip/test/widget_test.dart b/ios_app_clip/test/widget_test.dart index 50e99310f..a93c16084 100644 --- a/ios_app_clip/test/widget_test.dart +++ b/ios_app_clip/test/widget_test.dart @@ -15,9 +15,9 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:ios_app_clip/main.dart'; void main() { - testWidgets('Smoke test', (WidgetTester tester) async { + testWidgets('Smoke test', (tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(Demo()); + await tester.pumpWidget(const Demo()); expect(find.byType(FlutterLogo), findsOneWidget); });