getUniqueRandom method

Future<int> getUniqueRandom()

Returns a huge random value that will be computed just once.

Implementation

Future<int> getUniqueRandom() async {
  const String tag = _TAG_UNIQUE_RANDOM;
  int? result = _sharedPreferences.getInt(tag);
  if (result != null) {
    return result;
  }
  result = math.Random().nextInt(1 << 32);
  await _sharedPreferences.setInt(tag, result);
  return result;
}