flutter_driving_directions 1.0.1 copy "flutter_driving_directions: ^1.0.1" to clipboard
flutter_driving_directions: ^1.0.1 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({Key? key}) : super(key: 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
140
pub points
16%
popularity

Publisher

verified publisherjosephblough.com

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