setLogin method

Future<Either<String, dynamic>> setLogin(
  1. String login,
  2. String password
)

Sets the login credentials on the native platform using the provided login and password.

Returns an Either containing an error message on the left or the response on the right.

Implementation

Future<Either<String, dynamic>> setLogin(
  String login,
  String password,
) async {
  final response = await invokeNativeMethod('SmartfaceLicense.setLogin', {
    'arg0': login,
    'arg1': password,
  });

  if (response.isLeft() || !response.asRight) {
    return response;
  }

  await _secureStorageWrite(key: 'license_login', value: login);
  await _secureStorageWrite(key: 'license_password', value: password);

  return response;
}