With everything ready for iOS and Android, we can now add a GoogleMap widget to the main screen of our app, as follows:
- To use a package, as usual, we can import it at the top of the file. So, let's include the required Google Maps dependency in the main.dart file, like this:
import 'package:flutter/material.dart';import 'package:google_maps_flutter/google_maps_flutter.dart';
- Then, remove the stateful widget from the default app, and create a new stateful widget called MainMap, as follows:
class MainMap extends StatefulWidget { @override _MainMapState createState() => _MainMapState(); ...