Flutter

Install the Flutter SDK and track app sessions.

Last updated June 3, 2026

Install the Flutter SDK, initialize it on app boot, and track route changes as screen_view events. See what the SDK can do →.

Prerequisites

  • A Grometrics site ID from Settings > Tracking
  • Access to the mobile app code
  • A debug build or simulator for verification

Steps

1

Add version 1.1.1

Install the Flutter package.

terminal

1flutter pub add grometrics:^1.1.1
2

Create and start the tracker

Initialize one tracker before the first screen renders.

Replace YOUR_SITE_ID with your site ID from Settings > Tracking.

main.dart

1final grometrics = GrometricsTracker(2  configuration: const GrometricsConfiguration(3    websiteId: 'YOUR_SITE_ID',4  ),5);6await grometrics.start();
3

Identify and reset

Identify after login, then reset before sign-out on a shared device.

auth.dart

1await grometrics.identify(user.id);23await grometrics.reset();4await auth.signOut();
4

Track route changes

Send readable route names from your navigator observer.

app.dart

1await grometrics.trackScreen(2  name: 'Checkout',3  path: '/checkout',4);

Options / Configuration

OptionTypeRequiredDescription
websiteIdstringYour Grometrics site ID
appVersionstringnoPopulates app version filters

What happens next

Run the app and navigate between routes. Realtime should show app_open and screen_view events.

Verify your setup

Verify your setup

Troubleshooting

No event appears

Confirm the site ID matches Settings > Tracking and that the latest published code is running.

Was this page helpful?