casa_google_map 0.0.2 icon indicating copy to clipboard operation
casa_google_map: ^0.0.2 copied to clipboard

A Flutter package which can be used to make polylines(route) from a source to a destination, and make smooth animation when source start moving towards destination with smooth polyline removal from be [...]

A flutter package to make smooth animation between between two latlng in realtime.

A widget for flutter developers to easily integrate google map in their apps. It can be used to draw polyline between source/driver to destination. This plugin handle smooth animation between old latlng and new latlng value in realtime. It helps track driver and help getting device location permission. It also help you open GoogleMap or AppleMap apps.

Features #

  • Make polylines (route) between two locations by providing the latitude and longitude for both the locations.
  • Smooth animation between two locations.
  • The route is customizable in terms of color and width.
  • Ask for location permission
  • The plugin also offers realtime location tracking for a driver(if any) and shows a marker on the map which updates everytimes the driver's location changes.
  • All the markers are customizable.
  • Almost all the parameters defined in google_maps_flutter for the GoogleMap widget can be passed as arguments to the widget.

Getting Started #

  • Get an API key at

  • Enable Google Map SDK for each platform.

    • Go to Google Developers Console.
    • Choose the project that you want to enable Google Maps on.
    • Select the navigation menu and then select "Google Maps".
    • Select "APIs" under the Google Maps menu.
    • To enable Google Maps for Android, select "Maps SDK for Android" in the "Additional APIs" section, then select "ENABLE".
    • To enable Google Maps for iOS, select "Maps SDK for iOS" in the "Additional APIs" section, then select "ENABLE".
    • To enable Directions API, select "Directions API" in the "Additional APIs" section, then select "ENABLE".
    • Make sure the APIs you enabled are under the "Enabled APIs" section.

For more details, see Getting started with Google Maps Platform.

Android #

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:

<manifest ...
  <application ...
    <meta-data android:name=""
               android:value="YOUR KEY HERE"/>

iOS #

Specify your API key in the application delegate ios/Runner/AppDelegate.m:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GMSServices provideAPIKey:@"YOUR KEY HERE"];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];

Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift:

import UIKit
import Flutter
import GoogleMaps

@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)

Web #

Modify web/index.html

Get an API Key for Google Maps JavaScript API. Get started here. Modify the <head> tag of your web/index.html to load the Google Maps JavaScript API, like so:


  <!-- // Other stuff -->

  <script src=""></script>

Usage #

To use this plugin, add casa_google_map as a dependency in your pubspec.yaml file.

      sdk: flutter

First and foremost, import the widget.

import 'package:casa_google_map/casa_google_map.dart';

You can now add a CasaGoogleMap widget to your widget tree and pass all the required parameters to get started. This widget will create a route between the source and the destination LatLng's provided.

    apiKey: "YOUR KEY HERE",
    sourceLatLng: LatLng(40.484000837597925, -3.369978368282318),
    destinationLatLng: LatLng(40.48017307700204, -3.3618026599287987),

Sample Usage

void main() async {
  await Firebase.initializeApp();
  runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Casa Google Map',
      theme: ThemeData(primarySwatch:,
      home: return Scaffold(
      body: Stack(
        children: [
            apiKey: mapAPIKey,
            driverLatLng: myPosition != null
                ? LatLng(myPosition!.latitude, myPosition!.longitude)
                : null,
            destinationLatLng: destinationLatLng,
            driverMarkerIcon: const CasaMarkerIcon(
                assetPath: kDefaultDriverMarkerAssetPath,
                assetMarkerSize: Size.square(80.0)),
            //////////////    OPTIONAL PARAMETERS    //////////////
            routeWidth: 2,
            onNewCasaPositionListner: (casaPosition) {
              this.casaPosition = casaPosition;
            bottom: 20.0,
            left: 24.0,
            right: 24.0,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                  child: const Text(
                    "Start your journey",
                    style: TextStyle(fontSize: 13),
                  onPressed: () {
                  child: const Text(
                    "Open GoogleMap/AppleMap",
                    style: TextStyle(fontSize: 13),
                  onPressed: () {
                        destinationLatLng: destinationLatLng);

See the example directory for a complete sample app.

Created & Maintained By Techroom Team #

pub points


verified publisher

A Flutter package which can be used to make polylines(route) from a source to a destination, and make smooth animation when source start moving towards destination with smooth polyline removal from behind and also handle a driver's realtime location (if any) on the map.

View/report issues


API reference


Icon for licenses.BSD-3-Clause (LICENSE)


flutter, flutter_compass, flutter_polyline_points, geolocator, google_map_marker_animation, google_maps_flutter, maps_toolkit, url_launcher


Packages that depend on casa_google_map