Episode 167 - Realtime Geolocation with Flutter, Google Maps, and Firestore
by fireship-ioDart
Last 12 weeks · 0 commits
1 of 6 standards met
When run flutter run -v, it works. But on flutter run, it display this error, The following _CompileTimeError was thrown building FireMap(dirty, state: FireMapState#0f0b0): I/flutter (13678): 'package:google_tracker/main.dart': error: lib/main.dart:39:9: Error: No named parameter with the I/flutter (13678): name 'trackCameraPosition'. I/flutter (13678): trackCameraPosition: true, I/flutter (13678): ^^^^^^^^^^^^^^^^^^^ Here is my main.dart: ``` import 'package:google_maps_flutter/google_maps_flutter.dart'; void main() => runApp(MyApp()); GoogleMapController mapController; class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: FireMap(), ), ); } } class FireMap extends StatefulWidget { State createState() => FireMapState(); } class FireMapState extends State { GoogleMapController mapController; build(context) { return Stack(children: [ GoogleMap( initialCameraPosition: CameraPosition( target: LatLng(9.05785, 7.49508), zoom: 15, ), onMapCreated: _onMapCreated, myLocationEnabled: true, mapType: MapType.hybrid, compassEnabled: true, trackCameraPosition: true, ), Positioned( bottom: 50, right: 10, child: FlatButton( child: Icon(Icons.pin_drop, color: Colors.white), color: Colors.green, onPressed: () => _addMarker() ) ) ]); } _onMapCreated(GoogleMapController controller) { setState(() { mapController = controller; }); } } _addMarker() { var marker = MarkerOptions( position: mapController.cameraPosition.target, icon: BitmapDescriptor.defaultMarker, infoWindowText: InfoWindowText('Magic Marker', '🍄🍄🍄') ); mapController.addMarker(marker); } How do i solve this, thanks
Repository: fireship-io/167-flutter-geolocation-firestore. Description: Episode 167 - Realtime Geolocation with Flutter, Google Maps, and Firestore Stars: 49, Forks: 36. Primary language: Dart. Languages: Dart (83%), Objective-C (11.7%), Java (5.4%). Open PRs: 0, open issues: 2. Last activity: 7y ago. Community health: 25%. Top contributors: codediodeio.