GAM3RG33K / flutter_settings_screens

Settings Screen with Custom Shared Preference Interface
MIT License
176 stars 71 forks source link

setObject always throws an error in 0.3.3 #88

Closed korsvanloon closed 2 years ago

korsvanloon commented 2 years ago

Pretty obvious. It's missing the return statements.

@override
  Future<void> setObject<T>(String key, T? value) async {
    if (T is int || value is int) {
      await _preferences?.setInt(key, value as int);
    }
    if (T is double || value is double) {
      await _preferences?.setDouble(key, value as double);
    }
    if (T is bool || value is bool) {
      await _preferences?.setBool(key, value as bool);
    }
    if (T is String || value is String) {
      await _preferences?.setString(key, value as String);
    }
    throw Exception('No Implementation Found');
  }