airbridge_flutter_sdk 4.1.2 copy "airbridge_flutter_sdk: ^4.1.2" to clipboard
airbridge_flutter_sdk: ^4.1.2 copied to clipboard

Airbridge SDK for Flutter.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';

import 'package:airbridge_flutter_sdk_example/app.dart';
import 'package:airbridge_flutter_sdk_example/basic/utility/storage.dart';
import 'package:airbridge_flutter_sdk_example/basic/import.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  initFirebase();
  runApp(App());
  init();
}

Future<void> initFirebase() async {
  await Firebase.initializeApp();

  String? token;
  if (Platform.isAndroid) {
    token = await FirebaseMessaging.instance.getToken();
    print("[App] token : ${token ?? 'token NULL!'}");

  } else if(Platform.isIOS) {
    token = await FirebaseMessaging.instance.getAPNSToken();
    print("[App] apns : ${token ?? 'apns NULL!'}");
  }

  if (token != null) {
    Airbridge.registerPushToken(token);
  }
}

Future<void> init() async {
  Airbridge.setOnDeeplinkReceived((deeplink) {
    Storage.set('deeplink', deeplink);
  });

  Airbridge.setOnAttributionReceived((result) { 
    Storage.set('attribution', result);
  });
}
5
likes
140
pub points
88%
popularity

Publisher

verified publisherairbridge.io

Airbridge SDK for Flutter.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on airbridge_flutter_sdk