Get started

A newer version of this documentation is available. Switch to the latest version docs.

Add the contentsquare package in your pubspec.yaml:

pubspec.yaml
dependencies:
flutter:
sdk: flutter
contentsquare: ^3.10.0

then run

Terminal window
flutter pub get

To ensure optimal compatibility, make sure you respect the iOS compatibility documentation.

The plugin works out of the box.

The Contentsquare plugin is designed to function seamlessly during the app’s build process. For applications targeting unsupported platforms, the Contentsquare plugin will be automatically disabled with no further actions required. This eliminates potential conflicts and ensures a smooth build experience.

If you need support for a specific platform, reach out to your Contentsquare contact.

You do not need to do anything to start the SDK. Now that the SDK is a dependency of your app, it will autostart itself when your application starts.

Look at the native SDK docs for validation on each platform.

Note that iOS logs should be viewed through Console or Xcode.

Wrap the entire application inside the ContentsquareRoot widget:

main.dart
import 'package:flutter/material.dart';
import 'package:contentsquare/contentsquare.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ContentsquareRoot( // <-- Wrap the entire app inside the ContentsquareRoot widget imported from 'package:contentsquare/contentsquare.dart'
child: MaterialApp(
title: 'My Flutter App',
home: Home()
),
);
}
}

Once you have wrapped your application with the ContentsquareRoot widget, you will be able to access all Contentsquare API using Contentsquare().

Currently, only Flutter application on the following platforms are supported by the Contentsquare Flutter SDK:

  • Android
  • iOS

Calling the SDK on other platforms is safe but will not have any effect.

If you need to use the SDK on another platform, contact our support team.