isTimestampUpdated method

Future<bool> isTimestampUpdated(
  1. String key,
  2. int newUpdatedTimestamp
)

Implementation

Future<bool> isTimestampUpdated(String key, int newUpdatedTimestamp) async {
  var prefs = await SharedPreferences.getInstance();
  int? updatedTimestamp = prefs.getInt(key);
  prefs.setInt(key, newUpdatedTimestamp);
  if (updatedTimestamp != null) {
    if(newUpdatedTimestamp > updatedTimestamp) {
      return true;
    }
    return false;
  }
  return true;
}