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

retracted

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
0
points
950
downloads

Publisher

verified publisherairbridge.io

Weekly Downloads

Airbridge SDK for Flutter.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on airbridge_flutter_sdk