Flutter Quickstart
This is the fastest path to a working Bubbl integration in a Flutter app.
1) Add dependency
In pubspec.yaml:
dependencies:
bubbl_flutter_sdk: ^2.2.6
Package page: https://pub.dev/packages/bubbl_flutter_sdk
Then run:
flutter pub get
2) Complete platform setup
- Android: Android Setup
- iOS: iOS Setup
- Firebase: Firebase Setup
3) Boot the SDK
import 'package:bubbl_flutter_sdk/bubbl_flutter_sdk.dart';
final BubblFlutterSdk sdk = BubblFlutterSdk.instance;
final BubblBootResult result = await sdk.boot(
apiKey: 'YOUR_API_KEY',
options: const BubblBootOptions(
environment: BubblEnvironment.staging,
segmentationTags: <String>[],
geoPollIntervalMs: 300000,
defaultDistance: 25,
),
);
print('boot: initializedNow=${result.initializedNow}, alreadyInitialized=${result.alreadyInitialized}');
4) Request permissions and start tracking
// Push permission (Android 13+ and iOS).
if (!await sdk.notificationGranted()) {
await sdk.requestPushPermission();
}
// Location permission: request via your own permission package
// (for example geolocator or permission_handler) before tracking.
final bool started = await sdk.startLocationTracking();
print('tracking started: $started');
5) Subscribe to events
final notificationSub = sdk.notificationEvents().listen((payload) {
print('notification => $payload');
});
final geofenceSub = sdk.geofenceEvents().listen((payload) {
print('geofence => $payload');
});
// cleanup
await notificationSub.cancel();
await geofenceSub.cancel();
Continue with Method Reference, Usage Examples, and Modal Styling.