getTotalUsers method

Future<int> getTotalUsers()

Retrieves the total number of users from the native platform.

This method invokes a native method to get the list of users and returns the length of the list. If the response indicates an error (left side), it returns 0.

Returns:

  • A Future that completes with the total number of users as an int.

Note:

  • The method currently calls 'SmartfaceMobile.getUsers' instead of 'SmartfaceMobile.getTotalUsers' due to a bug.

Implementation

Future<int> getTotalUsers() async {
  // BUG: await invokeNativeMethod('SmartfaceMobile.getTotalUsers');
  final response = await invokeNativeMethod('SmartfaceMobile.getUsers');

  if (response.isLeft()) {
    return 0;
  }

  return response.asRight.length;
}