AliAuth class

阿里云认证的上游静态入口;将配置和事件交由平台插件,宿主负责注销监听。

import 'package:ali_auth_spm/ali_auth.dart';

Future<void> startAuth() async {
  AliAuth.loginListen(onEvent: (dynamic event) {});
  await AliAuth.initSdk(AliAuthModel('android-secret', 'ios-secret'));
}

Future<void> stopAuth() async {
  await AliAuth.quitPage();
  AliAuth.dispose();
}

Constructors

AliAuth()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

appleLogin → Future
苹果登录iOS专用
no setter
checkCellularDataEnable → Future
no setter
platformVersion → Future<String?>
获取设备版本信息
no setter
sdkVersion → Future<String?>
获取SDK版本号
no setter

Static Methods

checkAuthAvailable(String accessToken, String jwtToken, {required dynamic success(dynamic), required dynamic error(dynamic)}) → Future<void>
Web 鉴权;accessToken 与 jwtToken 由宿主服务端签发,不记录或持久化。
dispose() → void
销毁监听
getCurrentCarrierName() → Future<String>
强制关闭一键登录授权页面
getVerifyToken({required dynamic success(dynamic), required dynamic error(dynamic)}) → Future<void>
Web 取号校验;调用前应由宿主完成鉴权。
hideLoading() → Future<void>
强制关闭Loading
initSdk(AliAuthModel? config) → Future
初始化SDK sk 必须 isDialog 是否使用Dialog 弹窗登录 非必须 默认值false 非Dialog登录 debug 是否开启调试模式 非必须 默认true 开启 使用一键登录传入 SERVICE_TYPE_LOGIN 2 使用号码校验传入 SERVICE_TYPE_AUTH 1 默认值 2
login({int timeout = 5000}) → Future
一键登录
loginListen({bool type = true, required Function onEvent, Function? onError, dynamic isOnlyOne = true}) → void
数据监听
onChange({bool type = true}) → Stream?
初始化监听
openPage(String? pageRoute) → Future<void>
pageRoute
pause() → void
暂停
quitPage() → Future<void>
强制关闭一键登录授权页面
resume() → void
恢复