CloudBaseCore.init constructor
CloudBaseCore.init(?)
Implementation
factory CloudBaseCore.init(Map<String, dynamic> map) {
String? envId = map['env'] != null ? map['env'] : map['envId'];
// 没有缓存
if (envId == null && _cache[envId] == null) {
throw new CloudBaseException(
code: CloudBaseExceptionCode.INVALID_PARAM,
message: 'CloudBase 初始化实例失败,缺少参数 env');
}
if (map['appAccess'] == null && _cache[envId] == null) {
throw new CloudBaseException(
code: CloudBaseExceptionCode.INVALID_PARAM,
message:
'CloudBase 初始化实例失败,缺少参数 appAccess. 如果没有 appAccess, 请到云开发控制台设置移动安全来源.');
}
return _cache.putIfAbsent(envId!, () {
CloudBaseConfig config = CloudBaseConfig.fromMap(map);
return CloudBaseCore._internal(config);
});
}