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
- Flutter application development framework
- IDE such as Android Studio or VS Code
- Flutter plugin installed on the IDE
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:
-
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'
-
To pull the Tealium Flutter plugin dependency in your project, run the following command:
flutter pub get
-
Import the Dart code to your project:
import 'package:tealium/common.dart'; import 'package: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.
This page was last updated: March 15, 2024