airbridge_flutter_sdk 3.5.5 copy "airbridge_flutter_sdk: ^3.5.5" to clipboard
airbridge_flutter_sdk: ^3.5.5 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.deeplink.setDeeplinkListener((deeplink) {
    Storage.set('deeplink', deeplink);
  });

  Airbridge.attribution.setAttributionListener((result) { 
    Storage.set('attribution', result);
  });
}
5
likes
0
pub points
87%
popularity

Publisher

verified publisherairbridge.io

Airbridge SDK for Flutter.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on airbridge_flutter_sdk