tokenNeedRefresh static method

bool tokenNeedRefresh()

Method that checks if the Dexcom access_token needs to be refreshed.

Implementation

static bool tokenNeedRefresh() {

  DateTime expiration = Formats.fullDateFormat.parse(GetIt.instance<SharedPreferences>().getString('dexcomTokenExpires')!);

  bool ret = DateTime.now().isAfter(expiration);

  // Debugging
  final logger = Logger();
  logger.i('Tokens is ${ret? 'not' : ''} valid.');

  return ret;

}