MethodChannelIdwiseFlutter constructor
MethodChannelIdwiseFlutter()
Implementation
MethodChannelIdwiseFlutter() {
methodChannel.setMethodCallHandler((handler) async {
switch (handler.method) {
case 'onJourneyStarted':
journeyCallbacks?.onJourneyStarted(json.decode(handler.arguments));
break;
case 'onJourneyCompleted':
journeyCallbacks?.onJourneyCompleted(json.decode(handler.arguments));
break;
case 'onJourneyCancelled':
journeyCallbacks?.onJourneyCancelled(json.decode(handler.arguments));
break;
case 'onJourneyResumed':
journeyCallbacks?.onJourneyResumed(json.decode(handler.arguments));
break;
case 'onError':
journeyCallbacks?.onError(json.decode(handler.arguments));
break;
case 'onInitializeError':
_onInitializeErrorCallback?.call(json.decode(handler.arguments));
break;
case 'onStepCaptured':
stepCallbacks?.onStepCaptured(json.decode(handler.arguments));
break;
case 'onStepResult':
stepCallbacks?.onStepResult(json.decode(handler.arguments));
break;
case 'onStepSkipped':
stepCallbacks?.onStepSkipped(json.decode(handler.arguments));
break;
case 'onStepCancelled':
stepCallbacks?.onStepCancelled(json.decode(handler.arguments));
break;
case 'journeySummary':
print("journeysummarydart ${json.decode(handler.arguments)}");
dynamic map = json.decode(handler.arguments);
if (map["nameValuePairs"] != null) {
_onJourneySummaryCallback?.call(map["nameValuePairs"]);
} else {
_onJourneySummaryCallback?.call(map);
}
break;
default:
print('Unknown method from MethodChannel: ${handler.method}');
break;
}
});
}