setupWithCode method
Future<MoveAuthResult>
setupWithCode(
- String authCode,
- MoveConfig moveConfig,
- 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': <String, dynamic>{
'motionPermissionMandatory': options?.motionPermissionMandatory,
'backgroundLocationPermissionMandatory':
options?.backgroundLocationPermissionMandatory,
'deviceDiscovery': <String, dynamic>{
'startDelay': options?.deviceDiscovery?.startDelay,
'duration': options?.deviceDiscovery?.duration,
'interval': options?.deviceDiscovery?.interval,
'stopScanOnFirstDiscovered':
options?.deviceDiscovery?.stopScanOnFirstDiscovered,
},
'useBackendConfig': options?.useBackendConfig,
},
},
);
} 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, "");
}