MethodChannelIdwiseFlutter constructor
MethodChannelIdwiseFlutter()
Implementation
MethodChannelIdwiseFlutter() {
methodChannel.setMethodCallHandler((handler) async {
switch (handler.method) {
case 'onJourneyStarted':
journeyCallbacks?.onJourneyStarted(handler.arguments.toString());
break;
case 'onJourneyCompleted':
journeyCallbacks?.onJourneyCompleted();
break;
case 'onJourneyCancelled':
journeyCallbacks?.onJourneyCancelled();
break;
case 'onJourneyResumed':
journeyCallbacks?.onJourneyResumed(handler.arguments.toString());
break;
case 'onError':
journeyCallbacks?.onError(handler.arguments.toString());
break;
case 'onInitializeError':
_onInitializeErrorCallback?.call(handler.arguments.toString());
break;
case 'onStepCaptured':
final result = json.decode(handler.arguments.toString()) as Map;
stepCallbacks?.onStepCaptured(result["stepId"], result["capturedImage"]);
break;
case 'onStepResult':
stepCallbacks?.onStepResult(handler.arguments);
break;
case 'journeySummary':
_onJourneySummaryCallback?.call(handler.arguments);
break;
default:
print('Unknown method from MethodChannel: ${handler.method}');
break;
}
});
}