Install

Learn to install Tealium for Flutter.

Tealium for Flutter allows you to use the Tealium native mobile libraries for Android or iOS in your Flutter application.

Requirements

Sample Apps

To help to familiarize yourself with our library, the tracking methods, and best practice implementation, explore the Tealium for Flutter sample apps.

Install

To install the Tealium library for Flutter:

  1. In your Flutter app project, update the pubspec.yaml file to add the Tealium Flutter plugin dependency as follows:

    dependencies:
      flutter:
      sdk: flutter
      tealium: '2.0.3'
    
  2. To pull the Tealium Flutter plugin dependency in your project, run the following command:

    flutter pub get
    
  3. Import the Dart code to your project:

    import tealium/tealium.dart
    

Use The Tealium APIs in your Flutter project.

Initialize

Initialize the Tealium instance with the initialize() method, as shown in the following example:

var config = TealiumConfig(
    'ACCOUNT',
    'PROFILE',
    TealiumEnvironment.dev,
    [Collectors.AppData, Collectors.Lifecycle],
    [Dispatchers.RemoteCommands, Dispatchers.TagManagement],
    consentPolicy: ConsentPolicy.GDPR,
    useRemoteLibrarySettings: true,
    batchingEnabled: false,
    visitorServiceEnabled: true,
    consentExpiry: ConsentExpiry(5, TimeUnit.MINUTES));

  Tealium.initialize(config).then((value) => {
      print('Tealium initialized');
  });

See the Flutter API to learn more about initialization options.

Was this page helpful?

This page was last updated: January 7, 2023