getUserRank function

Future<UserRank?> getUserRank()

Implementation

Future<UserRank?> getUserRank() async {
  try {
    String? userRank = await platform.invokeMethod('getUserRank');
    if (kDebugMode) {
      print("Received user rank from sdk: $userRank");
    }
    return UserRank.fromJson(jsonDecode(userRank!));
  } on PlatformException catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getUserRank");
      print(e);
      print(stacktrace);
    }
    rethrow;
  } catch (e, stacktrace) {
    if (kDebugMode) {
      print("Error in getUserRank");
      print(e);
      print(stacktrace);
    }
    throw PlatformException(code: "PLUGIN_ERROR", message: e.toString());
  }
}