setupWithCode method

  1. @override
Future<MoveAuthResult> setupWithCode(
  1. String authCode,
  2. MoveConfig moveConfig,
  3. MoveOptions? options
)
override

The SDK will setup and authenticate a user. authCode Auth code to setup with.. Services in moveConfig must be enabled in the MOVE dashboard.

Implementation

@override
Future<MoveAuthResult> setupWithCode(
  String authCode,
  MoveConfig moveConfig,
  MoveOptions? options,
) async {
  try {
    await methodChannel.invokeMethod('setupWithCode', <String, dynamic>{
      'authCode': authCode,
      'config': moveConfig.buildConfigParameter(),
      'options': options?.toNative(),
    });
  } on PlatformException catch (e) {
    switch (e.code) {
      case "networkError":
        return MoveAuthResult(AuthSetupStatus.networkError, e.details ?? "");
      case "invalidCode":
        return MoveAuthResult(AuthSetupStatus.invalidCode, e.details ?? "");
    }
  }

  return MoveAuthResult(AuthSetupStatus.success, "");
}