handleMethodCall method
Handles method calls over the MethodChannel of this plugin. Note: Check the "federated" architecture for a new way of doing this: https://flutter.dev/go/federated-plugins
Implementation
Future<dynamic> handleMethodCall(MethodCall call) async {
switch (call.method) {
case _kMethodInstance:
final args = call.arguments as List<dynamic>;
final apiToken = args[0] as String;
final apiTokenSecret = args[1] as String;
return initialize(AuthConfig(
apiToken: apiToken,
apiTokenSecret: apiTokenSecret,
callbackUrl: '',
));
case _kMethodLogin:
final args = call.arguments as List<dynamic>;
return login(requestEmail: args[0] as bool);
case _kMethodGetSession:
return currentSession;
case _kMethodLogout:
return signOut();
default:
throw PlatformException(
code: 'Unimplemented',
details:
'twitter_auth_nullsafety for web doesn\'t implement \'${call.method}\'',
);
}
}