Before installing the ArcGIS Maps SDK for Flutter, make sure your development machine meets the system requirements.
Flutter package repository
The ArcGIS Maps SDK for Flutter can be integrated into your Flutter project in VS Code using Flutter's package repository, pub.dev.
VS Code
-
Open your Flutter project in VS Code.
-
Go to View > Terminal.
-
Add the
arcgis
package as a project dependency._maps Use dark colors for code blocks Copy dart pub add arcgis_maps
dart pub add
adds thearcgis
package to the_maps pubspec.yaml
as a dependency, and then retrieves the dependency to resolvepubspec.yaml
. -
Update to the latest compatible versions of all the dependencies by executing the following command:
Use dark colors for code blocks Copy flutter pub upgrade
Executing this command will update only the packages that your app depends upon.
-
Download and install
arcgis
:_maps _core Use dark colors for code blocks Copy dart run arcgis_maps install
Executing this command will download and set up the binary distribution of the ArcGIS Maps core functionality in your Flutter project. We recommend you add
arcgis
to your_maps _core .gitignore
file if checking into source control.
To use this API, add the following import statement to any of your dart code (.dart) files:
import 'package:arcgis_maps/arcgis_maps.dart';
Platform specific configuration
To develop for Android, iOS, or both, you must also make the following configuration changes in your Flutter project.
-
Update the following minimum requirements:
-
Android NDK version:
25.2.9519653
-
Android minimum SDK version:
26
android/app/build.gradleUse dark colors for code blocks 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29 30 31Change line Change line android { namespace = "com.esri.flutter_project_template" compileSdk = flutter.compileSdkVersion ndkVersion = "25.2.9519653" compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.esri.flutter_project_template" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = 26 targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName }
-
-
Update the Kotlin version:
- Kotlin version:
1.9.0
android/settings.gradleUse dark colors for code blocks 19 20 21 23Change line plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.1.0" apply false id "org.jetbrains.kotlin.android" version "1.9.0" apply false }
- Kotlin version:
Capabilities requiring permissions
The following permissions are required to deploy an application with a dependency on ArcGIS Maps SDK for Flutter. Add permission to access online resources and add permission to access the device's GPS. Note that users are only prompted to provide permission for access to device location if the app is actively using API that requires it.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:label="flutter_project_template"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
Enabling access to device's storage
If you require read/write operations to the device's storage, such as adding or exporting attachments, you may need to add the following additional permissions:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:label="flutter_project_template"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
Enabling user authentication
If you require the use of a system browser for user authentication, you need to add the following:
<activity
android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="YOUR_CALLBACK_URL_SCHEME_HERE" />
</intent-filter>
</activity>
Replace YOUR
with the scheme of the redirect URL used when you set up OAuth credentials in your portal. This is necessary so that the browser can communicate back to your app after the login workflow completes.
Additional downloads
Additional sources of sample code and data are available to enhance your development projects. You can even download this guide as stand-alone developer documentation.
Sample code
Get hands-on sample code that illustrates a variety of powerful capabilities that you can add to your own applications. Search for samples and browse the relevant code in the samples documentation or download the code from the samples repository and run them locally.
Stand-alone developer documentation
You can download the developer documentation as an archive from the downloads page. The archive contains instructions to serve the documentation from a local web server so you can access it without a connection to the internet. The stand-alone documentation includes the developer guide, API reference, tutorials, and samples documentation. This documentation is designed to run on a local stand-alone computer or on an internal network and not on the public internet.
To serve the documentation locally:
- Download the documentation for the SDK you want to use. The downloaded files are in a .zip archive format.
- Extract the archive to a local folder. The extracted archive has two subfolders:
public
andinstall
. - Open the
READM
file in theE.md install
folder and follow the instructions for your chosen web server.
Supplemental data
StreetMap Premium
StreetMap Premium delivers a high-quality, multiscale cartographic map display with enriched street data. In addition, it provides accurate geocoding, optimized routing, easy to follow directions, and powerful network analysis. StreetMap Premium maps can simultaneously fulfill the need for an address locator, street network dataset, and basemap in your apps. They are consistent across all regions of the world and are available for both online, connected scenarios and for use in offline, disconnected scenarios in the form of mobile map packages.
If you want to use StreetMap Premium data (the StreetMap Premium extension), download the demonstration data from the downloads page for development and testing. Please contact Esri Customer Service for access to a region of your choice for development and testing or to license StreetMap Premium data for deployment.
Projection Engine data
Datum transformations are used when geometries must be projected from one spatial reference to another when there is a difference in the datum that underlies the two spatial references. Datum transformations can be mathematically defined (equation-based transformations), or may rely on external supporting files (grid-based transformations). Certain Projection Engine data files must be present when you use a grid-based transformation in your app; attempting to use a transformation with missing Projection Engine files will cause an error. The API can detect whether the necessary files are available on the local file system.
If your app requires grid-based transformations, you can download supporting Projection Engine files from the downloads page. See the Spatial references topic for more information about working with coordinate systems, projections, and datum transformations.