Page updated Jan 16, 2024

Record events

Amplify Flutter v0 is now in Maintenance Mode until July 19th, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v0.

Please use the latest version (v1) of Amplify Flutter to get started.

If you are currently using v0, follow these instructions to upgrade to v1.

Record event

The Amplify analytics plugin also makes it easy to record custom events within the app. The plugin handles retry logic in the event the device looses network connectivity and automatically batches requests to reduce network bandwidth.

1Future<void> recordCustomEvent() async {
2 final event = AnalyticsEvent('PasswordReset');
5 ..addStringProperty('Channel', 'SMS')
6 ..addBoolProperty('Successful', true);
8 // You can also add the properties one by one like the following
9'ProcessDuration', 792);
10'doubleKey', 120.3);
12 await Amplify.Analytics.recordEvent(event: event);

The AWS Pinpoint event count updates in minutes after recording your event.

However, it can take upwards of 30 minutes for the event to display in the Filter section, and for its custom attributes to appear in Pinpoint.

Flush events

To manually flush events, call:

1await Amplify.Analytics.flushEvents();

Global Properties

You can register global properties which will be sent along with all invocations of Amplify.Analytics.recordEvent.

1Future<void> registerGlobalProperties() async {
2 final properties = AnalyticsProperties()
3 ..addStringProperty('AppStyle', 'DarkMode');
4 await Amplify.Analytics.registerGlobalProperties(
5 globalProperties: properties,
6 );

To unregister a global property, call Amplify.Analytics.unregisterGlobalProperties():

1Future<void> unregisterGlobalProperties() async {
2 await Amplify.Analytics.unregisterGlobalProperties(
3 propertyNames: ['AppStyle', 'OtherProperty'],
4 );