sendAuth function

Future<void> sendAuth({
  1. required BuildContext mContext,
  2. required String openId,
  3. required String scope,
  4. String language = "en",
  5. bool supportScan = false,
  6. int isTest = 0,
})

Implementation

Future<void> sendAuth({
  required BuildContext mContext,
  required String openId,
  required String scope,
  String language = "en",
  bool supportScan = false,
  int isTest = 0,
}) async {
  assert(scope != null && scope.trim().isNotEmpty);
  bool isInstalledLema = false;
  if (Platform.isAndroid) {
    isInstalledLema = await isLemaPayInstalled();
  }
  print("install->$isInstalledLema");

  if (!isInstalledLema) {
    final result = await Navigator.push(
      mContext,
      CupertinoPageRoute(
        builder: (context) => AuthPage(
          scope: scope,
          appid: openId,
          isTest: isTest,
          language: language,
          supportScan: supportScan,
        ),
      ),
    );
    if (null != result) {
      print("返回的内容=$result");

      _responseAuthController.add(
        LMAuthResponse.fromMap(result),
      );
    }
  } else {
    await _channel.invokeMethod("sendAuth", {"scope": scope});
  }
}