setIntList method

Future<bool> setIntList(
  1. String key,
  2. List<int> intList, {
  3. bool removeIfEmpty = true,
})

Implementation

Future<bool> setIntList(String key, List<int> intList, {bool removeIfEmpty = true})
async
{
    if (intList.isEmpty && removeIfEmpty)
        return _sharedPreferences.remove(key);

    final List<String> stringList = <String>[];
    for (final int i in intList)
        stringList.add(i.toString());

    return _sharedPreferences.setStringList(key, stringList);
}