updateUser method

  1. @override
Future<IAMPASSUser?> updateUser(
  1. String userID,
  2. IAMPASSUser userData,
  3. String notificationToken
)
override

Implementation

@override
Future<IAMPASSUser?> updateUser(
    String userID, IAMPASSUser userData, String notificationToken) async {
  // Conver the user to a string and send it to the
  String encodedUser = jsonEncode(userData.toJson());
  Map<String, String> args = {
    "user": encodedUser,
    "userID": userID,
    "notificationToken": notificationToken
  };

  final String? updatedUser =
      await methodChannel.invokeMethod<String>('UpdateUser', args);

  if (updatedUser != null) {
    Map<String, dynamic> map = jsonDecode(updatedUser);

    final IAMPASSUser result = IAMPASSUser.fromJson(map);
    return result;
  } else {
    return null;
  }
}