INNER CODE UNIT · Dart
MapsDemo
maplibre/flutter-maplibre-gl · maplibre_gl_example/lib/main.dart:261
class MapsDemo extends StatefulWidget {
const MapsDemo({super.key});
@override
State<MapsDemo> createState() => _MapsDemoState();
}
class _MapsDemoState extends State<MapsDemo> {
Future<void> _pushPage(BuildContext context, ExamplePage page) async {
// The page reads ExampleConstants.demoMapStyle while it builds, so wait
// for the probe started in main() to settle. Tapping a second example
// while it is still in flight awaits that same probe instead of putting
// a second burst of requests on the limiter.
await ExampleConstants.resolveDemoMapStyle();
if (!kIsWeb && page.needsLocationPermission) {
final status = await Permission.locationWhenInUse.status;
if (!status.isGranted) {
await Permission.locationWhenInUse.request();