update init 方法
parent
398b697084
commit
6fe2ed0cec
19
lib/mop.dart
19
lib/mop.dart
|
@ -9,6 +9,19 @@ typedef MopEventErrorCallback = void Function(dynamic event);
|
||||||
|
|
||||||
typedef ExtensionApiHandler = Future Function(dynamic params);
|
typedef ExtensionApiHandler = Future Function(dynamic params);
|
||||||
|
|
||||||
|
class ServerConfig {
|
||||||
|
String appkey;
|
||||||
|
String secret;
|
||||||
|
String apiServer;
|
||||||
|
String apiPrefix;
|
||||||
|
String cryptType;
|
||||||
|
|
||||||
|
ServerConfig(this.appkey, this.secret, this.apiServer, this.apiPrefix, this.cryptType);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() =>
|
||||||
|
{'appkey': appkey, 'secret': secret, 'apiServer': apiServer, 'apiPrefix': apiPrefix, 'cryptType':cryptType};
|
||||||
|
}
|
||||||
|
|
||||||
class Mop {
|
class Mop {
|
||||||
static final Mop _instance = new Mop._internal();
|
static final Mop _instance = new Mop._internal();
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
|
@ -74,7 +87,8 @@ class Mop {
|
||||||
String apiPrefix,
|
String apiPrefix,
|
||||||
String cryptType,
|
String cryptType,
|
||||||
bool disablePermission,
|
bool disablePermission,
|
||||||
String userId}) async {
|
String userId,
|
||||||
|
List<ServerConfig> serverConfigs}) async {
|
||||||
final Map ret = await _channel.invokeMethod('initialize', {
|
final Map ret = await _channel.invokeMethod('initialize', {
|
||||||
'appkey': appkey,
|
'appkey': appkey,
|
||||||
'secret': secret,
|
'secret': secret,
|
||||||
|
@ -82,7 +96,8 @@ class Mop {
|
||||||
'apiPrefix': apiPrefix,
|
'apiPrefix': apiPrefix,
|
||||||
'cryptType': cryptType,
|
'cryptType': cryptType,
|
||||||
'disablePermission': disablePermission,
|
'disablePermission': disablePermission,
|
||||||
'userId': userId
|
'userId': userId,
|
||||||
|
'serverConfigs',serverConfigs.map((e) => e.toJson())
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue