Skip to main content

Requirements

The following are required to use Journey’s TomTom Map Flutter SDK:
  • Minimum Flutter version: 3.22.0
  • Minimum iOS deployment target: 14.0
  • Xcode 15 or higher.
  • Built with Swift 5.9 or higher.
Additionally, you’ll need Journey’s token for our Dart and Cocoapods repositories. If you don’t a token, please contact us to set up your account.
Currently, only iOS is supported. Android support coming soon.

Adding Flutter dependency

To add the SDK to your Flutter project, first add a new Flutter token:
# 👇 replace TOKEN with your token
echo 'TOKEN' | dart pub token add https://registry.journey.tech/dart/tomtom_flutter
Now add the tomtom_flutter_map SDK:
dart pub add tomtom_flutter_map --hosted-url https://registry.journey.tech/dart/tomtom_flutter

Adding iOS dependencies

Update your ios/Podfile and assure the platform target is set to 14.0 or higher:
ios/Podfile
platform :ios, '14.0'
Add Journey’s and TomTom’s Cocoapods repositories to the top of your Podfile, with the provided token.
ios/Podfile
# 👇 replace TOKEN with the provided token
source 'https://registry.journey.tech/TOKEN/pods/tomtom_flutter.git'
Finally, install the dependencies:
cd ios/
pod install --repo-update
All dependencies should now be installed. See our example Podfile for a complete implementation.

Updating iOS permissions

Journey’s TomTom maps SDK can take display the user’s current location in the map.
ios/Runner/Info.plist
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your precise location is used to calculate turn-by-turn directions, show your location on the map, and help improve the map.</string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
  <key>LocationAccuracyAuthorizationDescription</key>
  <string>Please enable precise location. Turn-by-turn directions only work when precise location data is available.</string>
</dict>

Adding a map to your application

To add a TomTom map, you can use the TomTomMap widget:
class MyWidget extends StatelessWidget {
  const MyWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return TomTomMap(
      options: MapOptions(
        styleMode: MapManagerStyleMode.main,
        initialCameraPosition: MapManagerLatLng(
          latitude: 37.7749,
          longitude: -122.4194,
        ),
        initialCameraZoom: 12,
        apiKey: 'your_tomtom_api_key_here',
      ),
      onPlatformViewCreated: (MapManager mapManager) {
        print('onPlatformViewCreated');
      },
    );
  }
}
Check-out our example application in Github.

Next steps