Skip to content

Commit f365917

Browse files
committed
migrate from pedantic to flutter_lints
1 parent b243797 commit f365917

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+501
-488
lines changed

analysis_options.yaml

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,21 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:flutter_lints/flutter.yaml
22
linter:
33
rules:
44
- always_declare_return_types
5-
- annotate_overrides
6-
- avoid_function_literals_in_foreach_calls
7-
- avoid_null_checks_in_equality_operators
85
- avoid_returning_null
96
- avoid_unused_constructor_parameters
10-
- await_only_futures
11-
- camel_case_types
127
- cancel_subscriptions
138
- comment_references
14-
- constant_identifier_names
15-
- control_flow_in_finally
169
- directives_ordering
17-
- empty_statements
18-
- hash_and_equals
19-
- implementation_imports
2010
- invariant_booleans
21-
- iterable_contains_unrelated_type
22-
- list_remove_unrelated_type
2311
- no_adjacent_strings_in_list
24-
- non_constant_identifier_names
2512
- omit_local_variable_types
2613
- only_throw_errors
27-
- overridden_fields
28-
- package_names
29-
- package_prefixed_library_names
30-
- prefer_adjacent_string_concatenation
31-
- prefer_collection_literals
32-
- prefer_conditional_assignment
33-
- prefer_final_fields
34-
- prefer_initializing_formals
3514
- prefer_interpolation_to_compose_strings
36-
- prefer_null_aware_operators
3715
- prefer_single_quotes
38-
- prefer_typing_uninitialized_variables
3916
- sort_pub_dependencies
4017
- test_types_in_equals
4118
- throw_in_finally
42-
- unnecessary_brace_in_string_interps
43-
- unnecessary_getters_setters
4419
- unnecessary_lambdas
45-
- unnecessary_new
4620
- unnecessary_null_aware_assignments
4721
- unnecessary_statements
48-
- unnecessary_this

example/lib/main.dart

+37-33
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ import './pages/tile_loading_error_handle.dart';
3333
import './pages/widgets.dart';
3434
import './pages/wms_tile_layer.dart';
3535

36-
void main() => runApp(MyApp());
36+
void main() => runApp(const MyApp());
3737

3838
class MyApp extends StatelessWidget {
39+
const MyApp({Key? key}) : super(key: key);
40+
3941
// This widget is the root of your application.
4042
@override
4143
Widget build(BuildContext context) {
@@ -44,40 +46,42 @@ class MyApp extends StatelessWidget {
4446
theme: ThemeData(
4547
primarySwatch: mapBoxBlue,
4648
),
47-
home: HomePage(),
49+
home: const HomePage(),
4850
routes: <String, WidgetBuilder>{
49-
NetworkTileProviderPage.route: (context) => NetworkTileProviderPage(),
50-
WidgetsPage.route: (context) => WidgetsPage(),
51-
TapToAddPage.route: (context) => TapToAddPage(),
52-
EsriPage.route: (context) => EsriPage(),
53-
PolylinePage.route: (context) => PolylinePage(),
54-
MapControllerPage.route: (context) => MapControllerPage(),
51+
NetworkTileProviderPage.route: (context) =>
52+
const NetworkTileProviderPage(),
53+
WidgetsPage.route: (context) => const WidgetsPage(),
54+
TapToAddPage.route: (context) => const TapToAddPage(),
55+
EsriPage.route: (context) => const EsriPage(),
56+
PolylinePage.route: (context) => const PolylinePage(),
57+
MapControllerPage.route: (context) => const MapControllerPage(),
5558
AnimatedMapControllerPage.route: (context) =>
56-
AnimatedMapControllerPage(),
57-
MarkerAnchorPage.route: (context) => MarkerAnchorPage(),
58-
PluginPage.route: (context) => PluginPage(),
59-
PluginScaleBar.route: (context) => PluginScaleBar(),
60-
PluginZoomButtons.route: (context) => PluginZoomButtons(),
61-
OfflineMapPage.route: (context) => OfflineMapPage(),
62-
OnTapPage.route: (context) => OnTapPage(),
63-
MarkerRotatePage.route: (context) => MarkerRotatePage(),
64-
MovingMarkersPage.route: (context) => MovingMarkersPage(),
65-
CirclePage.route: (context) => CirclePage(),
66-
OverlayImagePage.route: (context) => OverlayImagePage(),
67-
PolygonPage.route: (context) => PolygonPage(),
68-
SlidingMapPage.route: (_) => SlidingMapPage(),
69-
WMSLayerPage.route: (context) => WMSLayerPage(),
70-
CustomCrsPage.route: (context) => CustomCrsPage(),
71-
LiveLocationPage.route: (context) => LiveLocationPage(),
72-
TileLoadingErrorHandle.route: (context) => TileLoadingErrorHandle(),
73-
TileBuilderPage.route: (context) => TileBuilderPage(),
74-
InteractiveTestPage.route: (context) => InteractiveTestPage(),
75-
ManyMarkersPage.route: (context) => ManyMarkersPage(),
76-
StatefulMarkersPage.route: (context) => StatefulMarkersPage(),
77-
MapInsideListViewPage.route: (context) => MapInsideListViewPage(),
78-
ResetTileLayerPage.route: (context) => ResetTileLayerPage(),
79-
EPSG4326Page.route: (context) => EPSG4326Page(),
80-
MaxBoundsPage.route: (context) => MaxBoundsPage(),
59+
const AnimatedMapControllerPage(),
60+
MarkerAnchorPage.route: (context) => const MarkerAnchorPage(),
61+
PluginPage.route: (context) => const PluginPage(),
62+
PluginScaleBar.route: (context) => const PluginScaleBar(),
63+
PluginZoomButtons.route: (context) => const PluginZoomButtons(),
64+
OfflineMapPage.route: (context) => const OfflineMapPage(),
65+
OnTapPage.route: (context) => const OnTapPage(),
66+
MarkerRotatePage.route: (context) => const MarkerRotatePage(),
67+
MovingMarkersPage.route: (context) => const MovingMarkersPage(),
68+
CirclePage.route: (context) => const CirclePage(),
69+
OverlayImagePage.route: (context) => const OverlayImagePage(),
70+
PolygonPage.route: (context) => const PolygonPage(),
71+
SlidingMapPage.route: (_) => const SlidingMapPage(),
72+
WMSLayerPage.route: (context) => const WMSLayerPage(),
73+
CustomCrsPage.route: (context) => const CustomCrsPage(),
74+
LiveLocationPage.route: (context) => const LiveLocationPage(),
75+
TileLoadingErrorHandle.route: (context) =>
76+
const TileLoadingErrorHandle(),
77+
TileBuilderPage.route: (context) => const TileBuilderPage(),
78+
InteractiveTestPage.route: (context) => const InteractiveTestPage(),
79+
ManyMarkersPage.route: (context) => const ManyMarkersPage(),
80+
StatefulMarkersPage.route: (context) => const StatefulMarkersPage(),
81+
MapInsideListViewPage.route: (context) => const MapInsideListViewPage(),
82+
ResetTileLayerPage.route: (context) => const ResetTileLayerPage(),
83+
EPSG4326Page.route: (context) => const EPSG4326Page(),
84+
MaxBoundsPage.route: (context) => const MaxBoundsPage(),
8185
},
8286
);
8387
}

example/lib/pages/animated_map_controller.dart

+19-19
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import '../widgets/drawer.dart';
77
class AnimatedMapControllerPage extends StatefulWidget {
88
static const String route = 'map_controller_animated';
99

10+
const AnimatedMapControllerPage({Key? key}) : super(key: key);
11+
1012
@override
1113
AnimatedMapControllerPageState createState() {
1214
return AnimatedMapControllerPageState();
@@ -79,66 +81,64 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
7981
height: 80.0,
8082
point: london,
8183
builder: (ctx) => Container(
82-
key: Key('blue'),
83-
child: FlutterLogo(),
84+
key: const Key('blue'),
85+
child: const FlutterLogo(),
8486
),
8587
),
8688
Marker(
8789
width: 80.0,
8890
height: 80.0,
8991
point: dublin,
90-
builder: (ctx) => Container(
91-
child: FlutterLogo(
92-
key: Key('green'),
93-
textColor: Colors.green,
94-
),
92+
builder: (ctx) => const FlutterLogo(
93+
key: Key('green'),
94+
textColor: Colors.green,
9595
),
9696
),
9797
Marker(
9898
width: 80.0,
9999
height: 80.0,
100100
point: paris,
101101
builder: (ctx) => Container(
102-
key: Key('purple'),
103-
child: FlutterLogo(textColor: Colors.purple),
102+
key: const Key('purple'),
103+
child: const FlutterLogo(textColor: Colors.purple),
104104
),
105105
),
106106
];
107107

108108
return Scaffold(
109-
appBar: AppBar(title: Text('Animated MapController')),
109+
appBar: AppBar(title: const Text('Animated MapController')),
110110
drawer: buildDrawer(context, AnimatedMapControllerPage.route),
111111
body: Padding(
112-
padding: EdgeInsets.all(8.0),
112+
padding: const EdgeInsets.all(8.0),
113113
child: Column(
114114
children: [
115115
Padding(
116-
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
116+
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
117117
child: Row(
118118
children: <Widget>[
119119
MaterialButton(
120120
onPressed: () {
121121
_animatedMapMove(london, 10.0);
122122
},
123-
child: Text('London'),
123+
child: const Text('London'),
124124
),
125125
MaterialButton(
126126
onPressed: () {
127127
_animatedMapMove(paris, 5.0);
128128
},
129-
child: Text('Paris'),
129+
child: const Text('Paris'),
130130
),
131131
MaterialButton(
132132
onPressed: () {
133133
_animatedMapMove(dublin, 5.0);
134134
},
135-
child: Text('Dublin'),
135+
child: const Text('Dublin'),
136136
),
137137
],
138138
),
139139
),
140140
Padding(
141-
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
141+
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
142142
child: Row(
143143
children: <Widget>[
144144
MaterialButton(
@@ -149,12 +149,12 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
149149
bounds.extend(london);
150150
mapController.fitBounds(
151151
bounds,
152-
options: FitBoundsOptions(
152+
options: const FitBoundsOptions(
153153
padding: EdgeInsets.only(left: 15.0, right: 15.0),
154154
),
155155
);
156156
},
157-
child: Text('Fit Bounds'),
157+
child: const Text('Fit Bounds'),
158158
),
159159
MaterialButton(
160160
onPressed: () {
@@ -167,7 +167,7 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
167167
mapController.centerZoomFitBounds(bounds);
168168
_animatedMapMove(centerZoom.center, centerZoom.zoom);
169169
},
170-
child: Text('Fit Bounds animated'),
170+
child: const Text('Fit Bounds animated'),
171171
),
172172
],
173173
),

example/lib/pages/circle.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import '../widgets/drawer.dart';
77
class CirclePage extends StatelessWidget {
88
static const String route = 'circle';
99

10+
const CirclePage({Key? key}) : super(key: key);
11+
1012
@override
1113
Widget build(BuildContext context) {
1214
var circleMarkers = <CircleMarker>[
@@ -20,13 +22,13 @@ class CirclePage extends StatelessWidget {
2022
];
2123

2224
return Scaffold(
23-
appBar: AppBar(title: Text('Circle')),
25+
appBar: AppBar(title: const Text('Circle')),
2426
drawer: buildDrawer(context, route),
2527
body: Padding(
26-
padding: EdgeInsets.all(8.0),
28+
padding: const EdgeInsets.all(8.0),
2729
child: Column(
2830
children: [
29-
Padding(
31+
const Padding(
3032
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
3133
child: Text('This is a map that is showing (51.5, -0.9).'),
3234
),

example/lib/pages/custom_crs/custom_crs.dart

+11-9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import '../../widgets/drawer.dart';
88
class CustomCrsPage extends StatefulWidget {
99
static const String route = 'custom_crs';
1010

11+
const CustomCrsPage({Key? key}) : super(key: key);
12+
1113
@override
1214
_CustomCrsPageState createState() => _CustomCrsPageState();
1315
}
@@ -54,8 +56,8 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
5456
];
5557

5658
final epsg3413Bounds = Bounds<double>(
57-
CustomPoint<double>(-4511619.0, -4511336.0),
58-
CustomPoint<double>(4510883.0, 4510996.0),
59+
const CustomPoint<double>(-4511619.0, -4511336.0),
60+
const CustomPoint<double>(4510883.0, 4510996.0),
5961
);
6062

6163
maxZoom = (resolutions.length - 1).toDouble();
@@ -76,7 +78,7 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
7678
// Some goeserver changes origin based on zoom level
7779
// and some are not at all (use explicit/implicit null or use [CustomPoint(0, 0)])
7880
// @see https://github.com/kartena/Proj4Leaflet/pull/171
79-
origins: [CustomPoint(0, 0)],
81+
origins: [const CustomPoint(0, 0)],
8082
// Scale factors (pixels per projection unit, for example pixels/meter) for zoom levels;
8183
// specify either scales or resolutions, not both
8284
scales: null,
@@ -88,13 +90,13 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
8890
@override
8991
Widget build(BuildContext context) {
9092
return Scaffold(
91-
appBar: AppBar(title: Text('Custom CRS')),
93+
appBar: AppBar(title: const Text('Custom CRS')),
9294
drawer: buildDrawer(context, CustomCrsPage.route),
9395
body: Padding(
94-
padding: EdgeInsets.all(8.0),
96+
padding: const EdgeInsets.all(8.0),
9597
child: Column(
9698
children: [
97-
Padding(
99+
const Padding(
98100
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
99101
child: Text(
100102
'This map is in EPSG:3413',
@@ -106,18 +108,18 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
106108
),
107109
),
108110
Padding(
109-
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
111+
padding: const EdgeInsets.only(top: 8.0, bottom: 2.0),
110112
child: Text(
111113
'$initText (${point.x.toStringAsFixed(5)}, ${point.y.toStringAsFixed(5)}) in EPSG:4326.',
112114
),
113115
),
114116
Padding(
115-
padding: EdgeInsets.only(top: 2.0, bottom: 2.0),
117+
padding: const EdgeInsets.only(top: 2.0, bottom: 2.0),
116118
child: Text(
117119
'Which is (${epsg4326.transform(epsg3413, point).x.toStringAsFixed(2)}, ${epsg4326.transform(epsg3413, point).y.toStringAsFixed(2)}) in EPSG:3413.',
118120
),
119121
),
120-
Padding(
122+
const Padding(
121123
padding: EdgeInsets.only(top: 2.0, bottom: 8.0),
122124
child: Text('Tap on map to get more coordinates!'),
123125
),

example/lib/pages/epsg4326_crs.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ import '../widgets/drawer.dart';
77
class EPSG4326Page extends StatelessWidget {
88
static const String route = 'EPSG4326 Page';
99

10+
const EPSG4326Page({Key? key}) : super(key: key);
11+
1012
@override
1113
Widget build(BuildContext context) {
1214
return Scaffold(
13-
appBar: AppBar(title: Text('EPSG4326')),
15+
appBar: AppBar(title: const Text('EPSG4326')),
1416
drawer: buildDrawer(context, route),
1517
body: Padding(
16-
padding: EdgeInsets.all(8.0),
18+
padding: const EdgeInsets.all(8.0),
1719
child: Column(
1820
children: [
19-
Padding(
21+
const Padding(
2022
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
2123
child: Text('This is a map that is showing (42.58, 12.43).'),
2224
),

example/lib/pages/esri.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ import '../widgets/drawer.dart';
77
class EsriPage extends StatelessWidget {
88
static const String route = 'esri';
99

10+
const EsriPage({Key? key}) : super(key: key);
11+
1012
@override
1113
Widget build(BuildContext context) {
1214
return Scaffold(
13-
appBar: AppBar(title: Text('Esri')),
15+
appBar: AppBar(title: const Text('Esri')),
1416
drawer: buildDrawer(context, route),
1517
body: Padding(
16-
padding: EdgeInsets.all(8.0),
18+
padding: const EdgeInsets.all(8.0),
1719
child: Column(
1820
children: [
19-
Padding(
21+
const Padding(
2022
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
2123
child: Text('Esri'),
2224
),

0 commit comments

Comments
 (0)