Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate from pedantic to flutter_lints #1183

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,21 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml
linter:
rules:
- always_declare_return_types
- annotate_overrides
- avoid_function_literals_in_foreach_calls
- avoid_null_checks_in_equality_operators
- avoid_returning_null
- avoid_unused_constructor_parameters
- await_only_futures
- camel_case_types
- cancel_subscriptions
- comment_references
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- no_adjacent_strings_in_list
- non_constant_identifier_names
- omit_local_variable_types
- only_throw_errors
- overridden_fields
- package_names
- package_prefixed_library_names
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_final_fields
- prefer_initializing_formals
- prefer_interpolation_to_compose_strings
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_typing_uninitialized_variables
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_statements
- unnecessary_this
70 changes: 37 additions & 33 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ import './pages/tile_loading_error_handle.dart';
import './pages/widgets.dart';
import './pages/wms_tile_layer.dart';

void main() => runApp(MyApp());
void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Expand All @@ -44,40 +46,42 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: mapBoxBlue,
),
home: HomePage(),
home: const HomePage(),
routes: <String, WidgetBuilder>{
NetworkTileProviderPage.route: (context) => NetworkTileProviderPage(),
WidgetsPage.route: (context) => WidgetsPage(),
TapToAddPage.route: (context) => TapToAddPage(),
EsriPage.route: (context) => EsriPage(),
PolylinePage.route: (context) => PolylinePage(),
MapControllerPage.route: (context) => MapControllerPage(),
NetworkTileProviderPage.route: (context) =>
const NetworkTileProviderPage(),
WidgetsPage.route: (context) => const WidgetsPage(),
TapToAddPage.route: (context) => const TapToAddPage(),
EsriPage.route: (context) => const EsriPage(),
PolylinePage.route: (context) => const PolylinePage(),
MapControllerPage.route: (context) => const MapControllerPage(),
AnimatedMapControllerPage.route: (context) =>
AnimatedMapControllerPage(),
MarkerAnchorPage.route: (context) => MarkerAnchorPage(),
PluginPage.route: (context) => PluginPage(),
PluginScaleBar.route: (context) => PluginScaleBar(),
PluginZoomButtons.route: (context) => PluginZoomButtons(),
OfflineMapPage.route: (context) => OfflineMapPage(),
OnTapPage.route: (context) => OnTapPage(),
MarkerRotatePage.route: (context) => MarkerRotatePage(),
MovingMarkersPage.route: (context) => MovingMarkersPage(),
CirclePage.route: (context) => CirclePage(),
OverlayImagePage.route: (context) => OverlayImagePage(),
PolygonPage.route: (context) => PolygonPage(),
SlidingMapPage.route: (_) => SlidingMapPage(),
WMSLayerPage.route: (context) => WMSLayerPage(),
CustomCrsPage.route: (context) => CustomCrsPage(),
LiveLocationPage.route: (context) => LiveLocationPage(),
TileLoadingErrorHandle.route: (context) => TileLoadingErrorHandle(),
TileBuilderPage.route: (context) => TileBuilderPage(),
InteractiveTestPage.route: (context) => InteractiveTestPage(),
ManyMarkersPage.route: (context) => ManyMarkersPage(),
StatefulMarkersPage.route: (context) => StatefulMarkersPage(),
MapInsideListViewPage.route: (context) => MapInsideListViewPage(),
ResetTileLayerPage.route: (context) => ResetTileLayerPage(),
EPSG4326Page.route: (context) => EPSG4326Page(),
MaxBoundsPage.route: (context) => MaxBoundsPage(),
const AnimatedMapControllerPage(),
MarkerAnchorPage.route: (context) => const MarkerAnchorPage(),
PluginPage.route: (context) => const PluginPage(),
PluginScaleBar.route: (context) => const PluginScaleBar(),
PluginZoomButtons.route: (context) => const PluginZoomButtons(),
OfflineMapPage.route: (context) => const OfflineMapPage(),
OnTapPage.route: (context) => const OnTapPage(),
MarkerRotatePage.route: (context) => const MarkerRotatePage(),
MovingMarkersPage.route: (context) => const MovingMarkersPage(),
CirclePage.route: (context) => const CirclePage(),
OverlayImagePage.route: (context) => const OverlayImagePage(),
PolygonPage.route: (context) => const PolygonPage(),
SlidingMapPage.route: (_) => const SlidingMapPage(),
WMSLayerPage.route: (context) => const WMSLayerPage(),
CustomCrsPage.route: (context) => const CustomCrsPage(),
LiveLocationPage.route: (context) => const LiveLocationPage(),
TileLoadingErrorHandle.route: (context) =>
const TileLoadingErrorHandle(),
TileBuilderPage.route: (context) => const TileBuilderPage(),
InteractiveTestPage.route: (context) => const InteractiveTestPage(),
ManyMarkersPage.route: (context) => const ManyMarkersPage(),
StatefulMarkersPage.route: (context) => const StatefulMarkersPage(),
MapInsideListViewPage.route: (context) => const MapInsideListViewPage(),
ResetTileLayerPage.route: (context) => const ResetTileLayerPage(),
EPSG4326Page.route: (context) => const EPSG4326Page(),
MaxBoundsPage.route: (context) => const MaxBoundsPage(),
},
);
}
Expand Down
38 changes: 19 additions & 19 deletions example/lib/pages/animated_map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import '../widgets/drawer.dart';
class AnimatedMapControllerPage extends StatefulWidget {
static const String route = 'map_controller_animated';

const AnimatedMapControllerPage({Key? key}) : super(key: key);

@override
AnimatedMapControllerPageState createState() {
return AnimatedMapControllerPageState();
Expand Down Expand Up @@ -79,66 +81,64 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
height: 80.0,
point: london,
builder: (ctx) => Container(
key: Key('blue'),
child: FlutterLogo(),
key: const Key('blue'),
child: const FlutterLogo(),
),
),
Marker(
width: 80.0,
height: 80.0,
point: dublin,
builder: (ctx) => Container(
child: FlutterLogo(
key: Key('green'),
textColor: Colors.green,
),
builder: (ctx) => const FlutterLogo(
key: Key('green'),
textColor: Colors.green,
),
),
Marker(
width: 80.0,
height: 80.0,
point: paris,
builder: (ctx) => Container(
key: Key('purple'),
child: FlutterLogo(textColor: Colors.purple),
key: const Key('purple'),
child: const FlutterLogo(textColor: Colors.purple),
),
),
];

return Scaffold(
appBar: AppBar(title: Text('Animated MapController')),
appBar: AppBar(title: const Text('Animated MapController')),
drawer: buildDrawer(context, AnimatedMapControllerPage.route),
body: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Row(
children: <Widget>[
MaterialButton(
onPressed: () {
_animatedMapMove(london, 10.0);
},
child: Text('London'),
child: const Text('London'),
),
MaterialButton(
onPressed: () {
_animatedMapMove(paris, 5.0);
},
child: Text('Paris'),
child: const Text('Paris'),
),
MaterialButton(
onPressed: () {
_animatedMapMove(dublin, 5.0);
},
child: Text('Dublin'),
child: const Text('Dublin'),
),
],
),
),
Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Row(
children: <Widget>[
MaterialButton(
Expand All @@ -149,12 +149,12 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
bounds.extend(london);
mapController.fitBounds(
bounds,
options: FitBoundsOptions(
options: const FitBoundsOptions(
padding: EdgeInsets.only(left: 15.0, right: 15.0),
),
);
},
child: Text('Fit Bounds'),
child: const Text('Fit Bounds'),
),
MaterialButton(
onPressed: () {
Expand All @@ -167,7 +167,7 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
mapController.centerZoomFitBounds(bounds);
_animatedMapMove(centerZoom.center, centerZoom.zoom);
},
child: Text('Fit Bounds animated'),
child: const Text('Fit Bounds animated'),
),
],
),
Expand Down
8 changes: 5 additions & 3 deletions example/lib/pages/circle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import '../widgets/drawer.dart';
class CirclePage extends StatelessWidget {
static const String route = 'circle';

const CirclePage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
var circleMarkers = <CircleMarker>[
Expand All @@ -20,13 +22,13 @@ class CirclePage extends StatelessWidget {
];

return Scaffold(
appBar: AppBar(title: Text('Circle')),
appBar: AppBar(title: const Text('Circle')),
drawer: buildDrawer(context, route),
body: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
const Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Text('This is a map that is showing (51.5, -0.9).'),
),
Expand Down
20 changes: 11 additions & 9 deletions example/lib/pages/custom_crs/custom_crs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import '../../widgets/drawer.dart';
class CustomCrsPage extends StatefulWidget {
static const String route = 'custom_crs';

const CustomCrsPage({Key? key}) : super(key: key);

@override
_CustomCrsPageState createState() => _CustomCrsPageState();
}
Expand Down Expand Up @@ -54,8 +56,8 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
];

final epsg3413Bounds = Bounds<double>(
CustomPoint<double>(-4511619.0, -4511336.0),
CustomPoint<double>(4510883.0, 4510996.0),
const CustomPoint<double>(-4511619.0, -4511336.0),
const CustomPoint<double>(4510883.0, 4510996.0),
);

maxZoom = (resolutions.length - 1).toDouble();
Expand All @@ -76,7 +78,7 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
// Some goeserver changes origin based on zoom level
// and some are not at all (use explicit/implicit null or use [CustomPoint(0, 0)])
// @see https://github.com/kartena/Proj4Leaflet/pull/171
origins: [CustomPoint(0, 0)],
origins: [const CustomPoint(0, 0)],
// Scale factors (pixels per projection unit, for example pixels/meter) for zoom levels;
// specify either scales or resolutions, not both
scales: null,
Expand All @@ -88,13 +90,13 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Custom CRS')),
appBar: AppBar(title: const Text('Custom CRS')),
drawer: buildDrawer(context, CustomCrsPage.route),
body: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
const Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
child: Text(
'This map is in EPSG:3413',
Expand All @@ -106,18 +108,18 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
),
),
Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 2.0),
padding: const EdgeInsets.only(top: 8.0, bottom: 2.0),
child: Text(
'$initText (${point.x.toStringAsFixed(5)}, ${point.y.toStringAsFixed(5)}) in EPSG:4326.',
),
),
Padding(
padding: EdgeInsets.only(top: 2.0, bottom: 2.0),
padding: const EdgeInsets.only(top: 2.0, bottom: 2.0),
child: Text(
'Which is (${epsg4326.transform(epsg3413, point).x.toStringAsFixed(2)}, ${epsg4326.transform(epsg3413, point).y.toStringAsFixed(2)}) in EPSG:3413.',
),
),
Padding(
const Padding(
padding: EdgeInsets.only(top: 2.0, bottom: 8.0),
child: Text('Tap on map to get more coordinates!'),
),
Expand Down
8 changes: 5 additions & 3 deletions example/lib/pages/epsg4326_crs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ import '../widgets/drawer.dart';
class EPSG4326Page extends StatelessWidget {
static const String route = 'EPSG4326 Page';

const EPSG4326Page({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('EPSG4326')),
appBar: AppBar(title: const Text('EPSG4326')),
drawer: buildDrawer(context, route),
body: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
const Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Text('This is a map that is showing (42.58, 12.43).'),
),
Expand Down
8 changes: 5 additions & 3 deletions example/lib/pages/esri.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ import '../widgets/drawer.dart';
class EsriPage extends StatelessWidget {
static const String route = 'esri';

const EsriPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Esri')),
appBar: AppBar(title: const Text('Esri')),
drawer: buildDrawer(context, route),
body: Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Padding(
const Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Text('Esri'),
),
Expand Down
Loading