flutter_driving_directions 2.0.0 copy "flutter_driving_directions: ^2.0.0" to clipboard
flutter_driving_directions: ^2.0.0 copied to clipboard

A Flutter plugin to launch native driving directions on Android and iOS platforms.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_driving_directions/flutter_driving_directions.dart';

void main() => runApp(const MyApp());

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      await FlutterDrivingDirections.launchDirections(
        latitude: 42.319935,
        longitude: -84.020364,
        address: '320 Main Street',
      );
    } on PlatformException {
      debugPrint('Failed to launch directions.');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: const Center(
          child: Text('Launching navigation\n'),
        ),
      ),
    );
  }
}
1
likes
160
points
196
downloads

Publisher

verified publisherjosephblough.com

Weekly Downloads

A Flutter plugin to launch native driving directions on Android and iOS platforms.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_driving_directions

Packages that implement flutter_driving_directions