flutter_driving_directions 1.0.0
flutter_driving_directions: ^1.0.0 copied to clipboard
A Flutter plugin to launch native driving directions.
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'),
),
),
);
}
}