Getting Started with Fullstory for Flutter Mobile Apps

Fullstory for Flutter Mobile Apps allows you to capture user events and important details about their session to better understand your user's experience with your app. This data can be used to analyze key metrics, understand user journeys through your app, and identify drop-off points in your most important user funnels. Data from your Flutter apps can be combined in Fullstory with sessions from your website and other mobile apps to provide a comprehensive view of your digital experience.

Fullstory for Flutter mobile apps includes limited data capture support. The following functionality is in development, but is not currently supported:

  • Visual session replay
  • Heatmaps

See Fullstory for Flutter Mobile Apps - API Overview for a list of list of all supported API methods for Flutter. In addition to the data captured via those API methods, Fullstory automatically captures the following data for Flutter apps:

  • Session metadata (e.g. device details, OS, location, app version, etc.)
  • Navigate events at top-level FlutterViewController/FlutterActivity
  • Network and Console capture
  • Visual capture of parts of the app built via a native mobile framework

To get started with Fullstory for Flutter Mobile Apps:

  1. Install the fullstory_flutter dart library by running the following command in the root directory of your flutter app: flutter pub add fullstory_flutter

    This will also install the Fullstory Coacoapod for iOS apps. However the Android library will need to be installed separately.
  2. Next, follow the below guides to configure this for your Android or iOS apps.

    For add-to-app configuration, see Flutter add-to-app modules below.
    Android Apps: Install and configure the Android library by following our our Getting Started with Android Data Capture guide.

    iOS Apps: Configure iOS starting from Step 1: Adding the Fullstory framework via CocoaPods Pod > Add the Build Phase in our Getting Started with iOS Data Capture guide. Note, in Step 1, you'll skip over the Add the Plugin step found under the via CocoaPods Pod instructions and begin immediately with the 'Add the Build Phase' instructions.
  3. Import the library into your dart code and begin using the API:
// Upon user login
// The second parameter is optional and can be updated later by calling FS.setUserVars()
FS.identify('462718483', {
'displayName': 'Daniel Falko',
'email': 'daniel.falko@example.com', });

// Update user details
// Arbitrary keys and values are allowed
// displayName and email get special treatment by Fullstory
FS.setUserVars({
'displayName': 'Daniel Falko',
'email': 'daniel.falko@example.com',
'membershipLevel': 'platinum',
});
// Upon user log out
FS.anonymize();
// Create custom events
FS.event('new thing created');
// ...with optional properties
FS.event('new thing created', {'name': 'foo', 'value': 2.5});
// Get the Fullstory session URL
// Will be null if there is no current session, see FSStatusListener
FS.getCurrentSessionURL().then((url) => print("Fullstory session url: $url"));
// Log messages
// Logs will appear in Dev tools > Console section of Fullstory playback
// Errors will also appear in the event list at the right
// Supported log levels are: log, debug, info, warn, error
FS.log(level: FSLogLevel.error, message:"Exception caught: $e");
// Get notified when the Fullstory session has started
// (The mixin can also be added to existing classes and widgets)
class MyStatusListener with FSStatusListener {
MyStatusListener() {
FS.setStatusListener(this);
}
@override
void onFSSession(String url) {
print("Fullstory session started: $url");
}
}
var listener = new MyStatusListener();

For more information on our Mobile APIs, please check out our our Developer Documentation. Additionally, you can refer to our Fullstory Flutter GitHub for working examples of our APIs. 

Flutter add-to-app modules

If you add your Flutter code to an existing Android/iOS app as a module, follow the directions above, applying Android and iOS steps to your apps, not the Flutter module.

When building the Flutter module for Android, you may need the following additional options when running flutter build aar (note: Flutter‘s -P flag requires a space, unlike Gradle’s).

  • -P shrink=false is needed if you get the error Execution failed for task ':flutter:minifyReleaseWithR8'. This option skips the minification phase for release builds, which is currently broken for plugins like Fullstory’s.
  • -P fsTarget=1.56.0 (or your version, instead) is needed if you encounter errors due to a version mismatch between your Android and Flutter Fullstory plugins.

Was this article helpful?

Got Questions?

Get in touch with a Fullstory rep, ask the community or check out our developer documentation.