setIntList method

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

Implementation

void setIntList(String key, List<int> intList, {bool removeIfEmpty = true})
{
    if (intList.length == 0 && removeIfEmpty)
        _sharedPreferences.remove(key);
    else
    {
        var stringList = List<String>.empty();
        for (int i in intList)
            stringList.add(i.toString());

        _sharedPreferences.setStringList(key, stringList);
    }
}