getIntList method

List<int> getIntList(
  1. String key,
  2. List<int> def
)

Implementation

List<int> getIntList(String key, List<int> def)
{
    try
    {
        if (_sharedPreferences.containsKey(key) == false)
            return def;

        final List<String>? stringList = _sharedPreferences.getStringList(key);
        if (stringList == null)
            return def;

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

        return intList;
    }
    catch (e)
    {
        logInfo(e.toString());
        logInfo('${_sharedPreferences.get(key)}');
        return def;
    }
}