init static method

Future<num> init()

Implementation

static Future<num> init() async {
  WidgetsFlutterBinding.ensureInitialized();
  _prefs = await SharedPreferences.getInstance();
  String? localNum = _prefs.getString("deviceNum");
  if (localNum == null) {
    deviceNum = _generateRandomString(9);
    _prefs.setString("deviceNum", deviceNum);
  } else {
    deviceNum = localNum;
  }
  // afDevKey在appsflyer后台,创建好应用可见,appid从应用商店复制
  final AppsFlyerOptions options = AppsFlyerOptions(
      afDevKey: _afDevKey,
      appId: _appId,
      timeToWaitForATTUserAuthorization: 15,
      showDebug: true);
  sdk = AppsflyerSdk(options);
  sdk?.initSdk(
      registerConversionDataCallback: true,
      registerOnAppOpenAttributionCallback: true,
      registerOnDeepLinkingCallback: true);
  DioNet.init();
  return await RedirectController()
      .getHomeState(Global.appKey, deviceNum: deviceNum);
}