maplauncherplus 1.0.1 copy "maplauncherplus: ^1.0.1" to clipboard
maplauncherplus: ^1.0.1 copied to clipboard

A plugin to launch maps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:maplauncherplus/maplauncherplus.dart';
import 'package:maplauncherplus/models/map_launcher_mode.dart';

void main() {
  runApp(MaterialApp(home: const MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _maplauncherplusPlugin = MapLauncherPlus();

  @override
  void initState() {
    super.initState();
    openMap();
  }

  Future<void> openMap() async {
    await _maplauncherplusPlugin.openMap(
      context: context,
      latitude: 23.07100418299024,
      longitude: 72.67174835041547,
      mode: MapLauncherMode.navigate,
    );

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(child: Text('Default Map')),
      ),
    );
  }
}