Skip to content

Commit 4a99a6c

Browse files
authored
[multi-packages] Migrate plus plugins to use flutter_lints (#267)
* Migrate plug plugins to use flutter_lints * Follow syntax of plus plugin repo
1 parent 45896bd commit 4a99a6c

File tree

23 files changed

+51
-40
lines changed

23 files changed

+51
-40
lines changed

analysis_options_plus.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
# This file was copied from plus_plugins/analysis_options.yaml.
22

3-
include: package:pedantic/analysis_options.yaml
3+
include: package:flutter_lints/flutter.yaml
44

55
analyzer:
6-
enable-experiment:
7-
- non-nullable
86
exclude:
97
# Ignore generated files
108
- '**/*.g.dart'
119
- 'lib/src/generated/*.dart'
1210

1311
linter:
1412
rules:
15-
public_member_api_docs: true
16-
prefer_final_in_for_each: true
17-
prefer_final_locals: true
13+
- prefer_final_in_for_each
14+
- prefer_final_locals

packages/battery_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev_dependencies:
1818
sdk: flutter
1919
integration_test_tizen:
2020
path: ../../integration_test/
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
flutter:
2424
uses-material-design: true

packages/battery_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
sdk: flutter
1919

2020
dev_dependencies:
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
environment:
2424
sdk: ">=2.12.0 <3.0.0"

packages/connectivity_plus/example/lib/main.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,35 @@
55
// ignore_for_file: public_member_api_docs
66

77
import 'dart:async';
8+
import 'dart:developer' as developer;
89

910
import 'package:connectivity_plus/connectivity_plus.dart';
1011
import 'package:flutter/foundation.dart';
1112
import 'package:flutter/material.dart';
1213
import 'package:flutter/services.dart';
1314

1415
void main() {
15-
runApp(MyApp());
16+
runApp(const MyApp());
1617
}
1718

1819
class MyApp extends StatelessWidget {
1920
// This widget is the root of your application.
21+
const MyApp({Key? key}) : super(key: key);
22+
2023
@override
2124
Widget build(BuildContext context) {
2225
return MaterialApp(
2326
title: 'Flutter Demo',
2427
theme: ThemeData(
2528
primarySwatch: Colors.blue,
2629
),
27-
home: MyHomePage(title: 'Flutter Demo Home Page'),
30+
home: const MyHomePage(title: 'Flutter Demo Home Page'),
2831
);
2932
}
3033
}
3134

3235
class MyHomePage extends StatefulWidget {
33-
MyHomePage({Key? key, required this.title}) : super(key: key);
36+
const MyHomePage({Key? key, required this.title}) : super(key: key);
3437

3538
final String title;
3639

@@ -65,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
6568
try {
6669
result = await _connectivity.checkConnectivity();
6770
} on PlatformException catch (e) {
68-
print(e.toString());
71+
developer.log(e.toString());
6972
return;
7073
}
7174

packages/connectivity_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev_dependencies:
1818
sdk: flutter
1919
integration_test_tizen:
2020
path: ../../integration_test/
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
flutter:
2424
uses-material-design: true

packages/connectivity_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
sdk: flutter
1919

2020
dev_dependencies:
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
environment:
2424
sdk: ">=2.12.0 <3.0.0"

packages/device_info_plus/example/lib/main.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66
// ignore_for_file: public_member_api_docs
77

88
import 'dart:async';
9+
import 'dart:developer' as developer;
910

1011
import 'package:flutter/material.dart';
1112
import 'package:flutter/services.dart';
1213
import 'package:device_info_plus_tizen/device_info_plus_tizen.dart';
1314

1415
void main() {
1516
runZonedGuarded(() {
16-
runApp(MyApp());
17+
runApp(const MyApp());
1718
}, (dynamic error, dynamic stack) {
18-
print(error);
19-
print(stack);
19+
developer.log(error);
20+
developer.log(stack);
2021
});
2122
}
2223

2324
class MyApp extends StatefulWidget {
25+
const MyApp({Key? key}) : super(key: key);
26+
2427
@override
2528
_MyAppState createState() => _MyAppState();
2629
}

packages/device_info_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dev_dependencies:
1717
sdk: flutter
1818
integration_test_tizen:
1919
path: ../../integration_test/
20-
pedantic: ^1.9.2
20+
flutter_lints: ^1.0.4
2121

2222
flutter:
2323
uses-material-design: true

packages/device_info_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
sdk: flutter
1919

2020
dev_dependencies:
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
environment:
2424
sdk: '>=2.12.0 <3.0.0'

packages/network_info_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dev_dependencies:
1616
sdk: flutter
1717
integration_test_tizen:
1818
path: ../../integration_test/
19-
pedantic: ^1.9.2
19+
flutter_lints: ^1.0.4
2020

2121
flutter:
2222
uses-material-design: true

packages/network_info_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
network_info_plus_platform_interface: ^1.1.0
1919

2020
dev_dependencies:
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
environment:
2424
sdk: ">=2.12.0 <3.0.0"

packages/package_info_plus/example/integration_test/package_info_plus_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void main() {
2121
});
2222

2323
testWidgets('example', (WidgetTester tester) async {
24-
await tester.pumpWidget(MyApp());
24+
await tester.pumpWidget(const MyApp());
2525
await tester.pumpAndSettle();
2626
expect(find.text('package_info_plus_tizen_example'), findsOneWidget);
2727
expect(

packages/package_info_plus/example/lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ import 'package:flutter/material.dart';
1010
import 'package:package_info_plus/package_info_plus.dart';
1111

1212
void main() {
13-
runApp(MyApp());
13+
runApp(const MyApp());
1414
}
1515

1616
class MyApp extends StatelessWidget {
17+
const MyApp({Key? key}) : super(key: key);
18+
1719
@override
1820
Widget build(BuildContext context) {
1921
return MaterialApp(
2022
title: 'PackageInfo Demo',
2123
theme: ThemeData(primarySwatch: Colors.blue),
22-
home: MyHomePage(title: 'PackageInfo example app'),
24+
home: const MyHomePage(title: 'PackageInfo example app'),
2325
);
2426
}
2527
}
2628

2729
class MyHomePage extends StatefulWidget {
28-
MyHomePage({Key? key, this.title}) : super(key: key);
30+
const MyHomePage({Key? key, this.title}) : super(key: key);
2931

3032
final String? title;
3133

packages/package_info_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev_dependencies:
1818
sdk: flutter
1919
integration_test_tizen:
2020
path: ../../integration_test/
21-
pedantic: ^1.9.2
21+
flutter_lints: ^1.0.4
2222

2323
flutter:
2424
uses-material-design: true

packages/package_info_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
package_info_plus_platform_interface: ^1.0.2
2020

2121
dev_dependencies:
22-
pedantic: ^1.9.2
22+
flutter_lints: ^1.0.4
2323

2424
environment:
2525
sdk: ">=2.12.0 <3.0.0"

packages/sensors_plus/example/lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,26 @@ import 'package:sensors_plus/sensors_plus.dart';
1111
import 'snake.dart';
1212

1313
void main() {
14-
runApp(MyApp());
14+
runApp(const MyApp());
1515
}
1616

1717
class MyApp extends StatelessWidget {
18+
const MyApp({Key? key}) : super(key: key);
19+
1820
@override
1921
Widget build(BuildContext context) {
2022
return MaterialApp(
2123
title: 'Sensors Demo',
2224
theme: ThemeData(
2325
primarySwatch: Colors.blue,
2426
),
25-
home: MyHomePage(title: 'Flutter Demo Home Page'),
27+
home: const MyHomePage(title: 'Flutter Demo Home Page'),
2628
);
2729
}
2830
}
2931

3032
class MyHomePage extends StatefulWidget {
31-
MyHomePage({Key? key, this.title}) : super(key: key);
33+
const MyHomePage({Key? key, this.title}) : super(key: key);
3234

3335
final String? title;
3436

packages/sensors_plus/example/lib/snake.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import 'package:flutter/material.dart';
1111
import 'package:sensors_plus/sensors_plus.dart';
1212

1313
class Snake extends StatefulWidget {
14-
Snake({this.rows = 20, this.columns = 20, this.cellSize = 10.0}) {
14+
Snake({Key? key, this.rows = 20, this.columns = 20, this.cellSize = 10.0})
15+
: super(key: key) {
1516
assert(10 <= rows);
1617
assert(10 <= columns);
1718
assert(5.0 <= cellSize);
@@ -22,6 +23,7 @@ class Snake extends StatefulWidget {
2223
final double cellSize;
2324

2425
@override
26+
// ignore: no_logic_in_create_state
2527
State<StatefulWidget> createState() => SnakeState(rows, columns, cellSize);
2628
}
2729

packages/sensors_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dev_dependencies:
1616
sdk: flutter
1717
integration_test_tizen:
1818
path: ../../integration_test/
19-
pedantic: ^1.9.2
19+
flutter_lints: ^1.0.4
2020

2121
flutter:
2222
uses-material-design: true

packages/sensors_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
sdk: flutter
1717

1818
dev_dependencies:
19-
pedantic: ^1.9.2
19+
flutter_lints: ^1.0.4
2020

2121
environment:
2222
sdk: ">=2.12.0 <3.0.0"

packages/share_plus/example/lib/image_previews.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _ImagePreview extends StatelessWidget {
5252
child: Stack(
5353
children: <Widget>[
5454
ConstrainedBox(
55-
constraints: BoxConstraints(
55+
constraints: const BoxConstraints(
5656
maxWidth: 200,
5757
maxHeight: 200,
5858
),
@@ -65,7 +65,7 @@ class _ImagePreview extends StatelessWidget {
6565
child: FloatingActionButton(
6666
backgroundColor: Colors.red,
6767
onPressed: onDelete,
68-
child: Icon(Icons.delete)),
68+
child: const Icon(Icons.delete)),
6969
),
7070
),
7171
],

packages/share_plus/example/lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import 'package:share_plus/share_plus.dart';
1111
import 'image_previews.dart';
1212

1313
void main() {
14-
runApp(DemoApp());
14+
runApp(const DemoApp());
1515
}
1616

1717
class DemoApp extends StatefulWidget {
18+
const DemoApp({Key? key}) : super(key: key);
19+
1820
@override
1921
DemoAppState createState() => DemoAppState();
2022
}
@@ -62,8 +64,8 @@ class DemoAppState extends State<DemoApp> {
6264
ImagePreviews(imagePaths, onDelete: _onDeleteImage),
6365
Center(
6466
child: ListTile(
65-
leading: Icon(Icons.add),
66-
title: Text('Add image'),
67+
leading: const Icon(Icons.add),
68+
title: const Text('Add image'),
6769
onTap: () async {
6870
final imagePicker = ImagePicker();
6971
final pickedFile = await imagePicker.pickImage(

packages/share_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dev_dependencies:
2121
sdk: flutter
2222
integration_test_tizen:
2323
path: ../../integration_test/
24-
pedantic: ^1.9.2
24+
flutter_lints: ^1.0.4
2525

2626
flutter:
2727
uses-material-design: true

packages/share_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
share_plus_platform_interface: ^2.0.0
2020

2121
dev_dependencies:
22-
pedantic: ^1.9.2
22+
flutter_lints: ^1.0.4
2323

2424
environment:
2525
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)