amap_flutter 0.4.1 copy "amap_flutter: ^0.4.1" to clipboard
amap_flutter: ^0.4.1 copied to clipboard

A Flutter plugin that integrated Amap SDK, support Android, iOS and Web.

AMap for Flutter #

pub package

A Flutter plugin that provides a AMapFlutter widget.

Android iOS
Support SDK 26+ iOS 12+

Usage #

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

Getting Started #

Log in to the AMap Services console to get an API key at https://console.amap.com/dev/key/app;

  • Go to AMap Service Console, expand the Application Management menu and select My Apps;
  • Click Create Application on the right, if you have already created an application, you can directly select Add Key;
  • Select platform, enter key name, and enter package name in th panel.

Initializaition #

Before using AMapFlutter widget, you have to call static method init of AMapFlutter, for example:

AMapFlutter.init(
  apiKey: ApiKey(
    iosKey: "a4a1394fe817c2f86a424b897b4a9af4",
    androidKey: "d0065c21d2aedd0b234bfb7b88e5d6b2",
    webKey: "fc9908dc4103f3d8274070bb34ab37af",
  ),
  agreePrivacy: true,
);
copied to clipboard

Sample Usage #

  • You can now add a AMapFlutter widget to your widget tree. The AMapFlutter widget should be used within a widget with a bounded size. Using it in an unbounded widget will cause the application to throw a Flutter exception.
class Demo extends StatefulWidget {
  const Demo({Key? key}) : super(key: key);

  static const title = 'amap_flutter_example';

  @override
  State<Demo> createState() => _DemoState();
}

class _DemoState extends State<Demo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(Demo.title),
      ),
      body: AMapFlutter(),
    );
  }
}
copied to clipboard

See the example directory for a complete sample app.

4
likes
140
points
62
downloads

Publisher

unverified uploader

Weekly Downloads

2024.08.07 - 2025.02.19

A Flutter plugin that integrated Amap SDK, support Android, iOS and Web.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_plugin_android_lifecycle, flutter_web_plugins, geolocator, js, latlong2, plugin_platform_interface, stream_transform

More

Packages that depend on amap_flutter