configure method
Implementation
Future<void> configure(String appSecret,
{required String service,
required String deviceid,
bool debug = false}) async {
this.appSecret = appSecret;
this.service = service;
this.deviceid = deviceid;
this.debug = debug;
if (debug) {
Logger.level = Level.debug;
} else {
Logger.level = Level.info;
}
CanaryDio.instance().configure(service);
var prefs = await SharedPreferences.getInstance();
_mockOn = prefs.getBool('mockOn') ?? false;
if (_mockOn) {
channel.invokeMethod('enableMock', _mockOn);
}
var map =
jsonDecode(prefs.getString('user') ?? "{}") as Map<String, dynamic>?;
if (map != null && map.isNotEmpty) {
user.value = User.fromJson(map);
}
MockManager.instance().update();
channel.setMethodCallHandler(_callHandler);
CanaryWebSocket.instance.configure(service, deviceid, appSecret);
}