Skip to content

Commit 4633bb0

Browse files
Add flutter_lints to ios_app_clip (#824)
1 parent b34cc56 commit 4633bb0

File tree

5 files changed

+45
-9
lines changed

5 files changed

+45
-9
lines changed

ios_app_clip/analysis_options.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
analyzer:
4+
strong-mode:
5+
implicit-casts: false
6+
implicit-dynamic: false
7+
8+
linter:
9+
rules:
10+
avoid_types_on_closure_parameters: true
11+
avoid_void_async: true
12+
cancel_subscriptions: true
13+
close_sinks: true
14+
directives_ordering: true
15+
package_api_docs: true
16+
package_prefixed_library_names: true
17+
test_types_in_equals: true
18+
throw_in_finally: true
19+
unnecessary_statements: true

ios_app_clip/lib/main.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import 'package:flutter/cupertino.dart';
77
import 'package:flutter/material.dart';
88

99
void main() {
10-
runApp(Demo());
10+
runApp(const Demo());
1111
}
1212

1313
// The same content is shown for both the main app target and in the App
1414
// Clip.
1515
class Demo extends StatefulWidget {
16+
const Demo({Key key}) : super(key: key);
17+
1618
@override
1719
State<StatefulWidget> createState() => _DemoState();
1820
}
@@ -22,7 +24,7 @@ class _DemoState extends State<Demo> {
2224

2325
@override
2426
void initState() {
25-
DeviceInfoPlugin().iosInfo.then((IosDeviceInfo info) {
27+
DeviceInfoPlugin().iosInfo.then((info) {
2628
setState(() {
2729
deviceInfo = '${info.name} on ${info.systemName} version '
2830
'${info.systemVersion}';
@@ -35,16 +37,16 @@ class _DemoState extends State<Demo> {
3537
Widget build(BuildContext context) {
3638
return CupertinoApp(
3739
home: CupertinoPageScaffold(
38-
navigationBar: CupertinoNavigationBar(
40+
navigationBar: const CupertinoNavigationBar(
3941
middle: Text('App Clip'),
4042
),
4143
child: Center(
4244
child: Column(
4345
mainAxisAlignment: MainAxisAlignment.center,
4446
children: <Widget>[
4547
Text(deviceInfo),
46-
Padding(padding: EdgeInsets.only(top: 18)),
47-
FlutterLogo(size: 128),
48+
const Padding(padding: EdgeInsets.only(top: 18)),
49+
const FlutterLogo(size: 128),
4850
],
4951
),
5052
),

ios_app_clip/pubspec.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,25 @@ packages:
7676
description: flutter
7777
source: sdk
7878
version: "0.0.0"
79+
flutter_lints:
80+
dependency: "direct dev"
81+
description:
82+
name: flutter_lints
83+
url: "https://pub.dartlang.org"
84+
source: hosted
85+
version: "1.0.3"
7986
flutter_test:
8087
dependency: "direct dev"
8188
description: flutter
8289
source: sdk
8390
version: "0.0.0"
91+
lints:
92+
dependency: transitive
93+
description:
94+
name: lints
95+
url: "https://pub.dartlang.org"
96+
source: hosted
97+
version: "1.0.1"
8498
matcher:
8599
dependency: transitive
86100
description:

ios_app_clip/pubspec.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: ios_app_clip
22
description: An example Flutter project that can build as an App Clip.
33

4-
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
4+
publish_to: "none" # Remove this line if you wish to publish to pub.dev
55

66
version: 1.0.0+1
77

@@ -13,10 +13,11 @@ dependencies:
1313
sdk: flutter
1414

1515
cupertino_icons: ^1.0.0
16-
device_info: '>=0.4.2+7 <2.0.0'
16+
device_info: ">=0.4.2+7 <2.0.0"
1717

1818
dev_dependencies:
1919
flutter_test:
2020
sdk: flutter
21+
flutter_lints: ^1.0.0
2122

2223
flutter:

ios_app_clip/test/widget_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import 'package:flutter_test/flutter_test.dart';
1515
import 'package:ios_app_clip/main.dart';
1616

1717
void main() {
18-
testWidgets('Smoke test', (WidgetTester tester) async {
18+
testWidgets('Smoke test', (tester) async {
1919
// Build our app and trigger a frame.
20-
await tester.pumpWidget(Demo());
20+
await tester.pumpWidget(const Demo());
2121

2222
expect(find.byType(FlutterLogo), findsOneWidget);
2323
});

0 commit comments

Comments
 (0)