| void _onMapViewReady() async { | |
| // Create a map with the Navigation Night basemap style. | |
| _mapViewController.arcGISMap = | |
| ArcGISMap.withBasemapStyle(BasemapStyle.arcGISNavigationNight); | |
| // Set the initial system location data source. | |
| _mapViewController.locationDisplay.dataSource = _locationDataSource; | |
| // Set the initial system location auto-pan mode. | |
| _mapViewController.locationDisplay.autoPanMode = LocationDisplayAutoPanMode.recenter; | |
| // Attempt to start the location data source (this will prompt the user for permission). | |
| try { | |
| await _locationDataSource.start(); | |
| } on ArcGISException catch (e) { | |
| if (mounted) { | |
| showDialog( | |
| context: context, | |
| builder: (_) => AlertDialog(content: Text(e.message)), | |
| ); | |
| } | |
| } | |
| // Set the ready state variable to true to enable the UI. | |
| setState(() => _ready = true); | |
| } |