diff --git a/lib/mop.dart b/lib/mop.dart index 0b30f08..30fbd31 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -9,6 +9,19 @@ typedef MopEventErrorCallback = void Function(dynamic event); 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 toJson() => + {'appkey': appkey, 'secret': secret, 'apiServer': apiServer, 'apiPrefix': apiPrefix, 'cryptType':cryptType}; +} + class Mop { static final Mop _instance = new Mop._internal(); MethodChannel _channel; @@ -74,7 +87,8 @@ class Mop { String apiPrefix, String cryptType, bool disablePermission, - String userId}) async { + String userId, + List serverConfigs}) async { final Map ret = await _channel.invokeMethod('initialize', { 'appkey': appkey, 'secret': secret, @@ -82,7 +96,8 @@ class Mop { 'apiPrefix': apiPrefix, 'cryptType': cryptType, 'disablePermission': disablePermission, - 'userId': userId + 'userId': userId, + 'serverConfigs',serverConfigs.map((e) => e.toJson()) }); return ret; }