From 45e4a228f524d4e0ce7fb968fcd4bcf77e9da9bb Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Wed, 3 Jul 2019 06:36:13 +1000 Subject: [PATCH] Add analysis_options, fix and format. (#102) --- flutter_maps_firestore/analysis_options.yaml | 30 ++++++++++++++++++++ flutter_maps_firestore/lib/main.dart | 24 ++++++++-------- flutter_maps_firestore/pubspec.lock | 8 +++--- flutter_maps_firestore/pubspec.yaml | 1 + flutter_maps_firestore/test/widget_test.dart | 2 +- 5 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 flutter_maps_firestore/analysis_options.yaml diff --git a/flutter_maps_firestore/analysis_options.yaml b/flutter_maps_firestore/analysis_options.yaml new file mode 100644 index 000000000..f117e8a5f --- /dev/null +++ b/flutter_maps_firestore/analysis_options.yaml @@ -0,0 +1,30 @@ +include: package:pedantic/analysis_options.yaml + +analyzer: + strong-mode: + implicit-casts: false + implicit-dynamic: false + +linter: + rules: + - avoid_types_on_closure_parameters + - avoid_void_async + - await_only_futures + - camel_case_types + - cancel_subscriptions + - close_sinks + - constant_identifier_names + - control_flow_in_finally + - empty_statements + - hash_and_equals + - implementation_imports + - non_constant_identifier_names + - package_api_docs + - package_names + - package_prefixed_library_names + - test_types_in_equals + - throw_in_finally + - unnecessary_brace_in_string_interps + - unnecessary_getters_setters + - unnecessary_new + - unnecessary_statements diff --git a/flutter_maps_firestore/lib/main.dart b/flutter_maps_firestore/lib/main.dart index dad0f1f1f..2fd9cd8c1 100644 --- a/flutter_maps_firestore/lib/main.dart +++ b/flutter_maps_firestore/lib/main.dart @@ -109,7 +109,7 @@ class StoreCarousel extends StatelessWidget { padding: const EdgeInsets.only(top: 10), child: SizedBox( height: 90, - child: new StoreCarouselList( + child: StoreCarouselList( documents: documents, mapController: mapController, ), @@ -187,8 +187,8 @@ class _StoreListTileState extends State { } Future _retrievePlacesDetails() async { - final details = - await _placesApiClient.getDetailsByPlaceId(widget.document['placeId']); + final details = await _placesApiClient + .getDetailsByPlaceId(widget.document['placeId'] as String); if (!_disposed) { setState(() { _placePhotoUrl = _placesApiClient.buildPhotoUrl( @@ -202,8 +202,8 @@ class _StoreListTileState extends State { @override Widget build(BuildContext context) { return ListTile( - title: Text(widget.document['name']), - subtitle: Text(widget.document['address']), + title: Text(widget.document['name'] as String), + subtitle: Text(widget.document['address'] as String), leading: Container( width: 100, height: 100, @@ -220,8 +220,8 @@ class _StoreListTileState extends State { CameraUpdate.newCameraPosition( CameraPosition( target: LatLng( - widget.document['location'].latitude, - widget.document['location'].longitude, + widget.document['location'].latitude as double, + widget.document['location'].longitude as double, ), zoom: 16, ), @@ -253,15 +253,15 @@ class StoreMap extends StatelessWidget { ), markers: documents .map((document) => Marker( - markerId: MarkerId(document['placeId']), + markerId: MarkerId(document['placeId'] as String), icon: BitmapDescriptor.defaultMarkerWithHue(_pinkHue), position: LatLng( - document['location'].latitude, - document['location'].longitude, + document['location'].latitude as double, + document['location'].longitude as double, ), infoWindow: InfoWindow( - title: document['name'], - snippet: document['address'], + title: document['name'] as String, + snippet: document['address'] as String, ), )) .toSet(), diff --git a/flutter_maps_firestore/pubspec.lock b/flutter_maps_firestore/pubspec.lock index 5d3bad86c..bdc3e75e0 100644 --- a/flutter_maps_firestore/pubspec.lock +++ b/flutter_maps_firestore/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.2.0" boolean_selector: dependency: transitive description: @@ -110,7 +110,7 @@ packages: source: hosted version: "1.6.2" pedantic: - dependency: transitive + dependency: "direct dev" description: name: pedantic url: "https://pub.dartlang.org" @@ -122,7 +122,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" sky_engine: dependency: transitive description: flutter @@ -169,7 +169,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.4" + version: "0.2.5" typed_data: dependency: transitive description: diff --git a/flutter_maps_firestore/pubspec.yaml b/flutter_maps_firestore/pubspec.yaml index 054008413..e4b281044 100644 --- a/flutter_maps_firestore/pubspec.yaml +++ b/flutter_maps_firestore/pubspec.yaml @@ -16,6 +16,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + pedantic: ^1.5.0 flutter: uses-material-design: true diff --git a/flutter_maps_firestore/test/widget_test.dart b/flutter_maps_firestore/test/widget_test.dart index d5dbc1d32..899d7439e 100644 --- a/flutter_maps_firestore/test/widget_test.dart +++ b/flutter_maps_firestore/test/widget_test.dart @@ -5,5 +5,5 @@ import 'package:flutter_test/flutter_test.dart'; void main() { - testWidgets('This test always passes', (WidgetTester tester) async {}); + testWidgets('This test always passes', (tester) async {}); }