getUserStreak function

Future<UserStreak?> getUserStreak()

Implementation

Future<UserStreak?> getUserStreak() async {
  try {
    String? userStreak = await platform.invokeMethod('getUserStreak');

    if (userStreak == null) {
      return null;
    }
    return UserStreak.fromJson(jsonDecode(userStreak));
  } on PlatformException catch (e, stacktrace) {
    if (kDebugMode) {
      print(e);
      print(stacktrace);
    }
    rethrow;
  } catch (e, stacktrace) {
    if (kDebugMode) {
      print(e);
      print(stacktrace);
    }
    throw PlatformException(code: "PLUGIN_ERROR", message: e.toString());
  }
}