startAccountLinking method

  1. @override
Future<KevinSessionResult> startAccountLinking(
  1. KevinAccountSessionConfiguration configuration
)

Implementation

@override
Future<KevinSessionResult> startAccountLinking(
  KevinAccountSessionConfiguration configuration,
) async {
  try {
    final resultJsonString = await methodChannel.invokeMethod<String>(
      KevinFlutterAccountsMethods.startAccountLinking,
      configuration.toMap(),
    );

    final result = jsonDecode(resultJsonString!);

    return KevinSessionResultLinkingSuccess.fromMap(result);
  } on PlatformException catch (error) {
    final parsedError = KevinErrorHelper.parseError(error);

    if (parsedError != null) {
      return parsedError;
    }

    rethrow;
  }
}