changeName method

  1. @override
Future<bool> changeName(
  1. String userId,
  2. String name
)

Change a specific user's name.
userId the identify of the user
name the new name of the user
Return true indicates that name change is success. Otherwise, this function returns false.

Implementation

@override
Future<bool> changeName(String userId, String name) async {
  var params = <String, dynamic>{};
  params.putIfAbsent("userId", () => userId);
  params.putIfAbsent("name", () => name);

  return await methodChannel
      .invokeMethod<bool>('changeName', params)
      .then<bool>((bool? value) => value ?? false);
}