|  |  | @ -15,22 +15,17 @@ abstract interface class SettingsStorage { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<bool> remove(final String key); |  |  |  |   Future<bool> remove(final String key); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | @immutable |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | @internal |  |  |  | @internal | 
			
		
	
		
		
			
				
					
					|  |  |  | class AppStorage implements SettingsStorage { |  |  |  | final class NeonStorage { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   const AppStorage(this._id); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   final String _id; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   /// Shared preferences instance. |  |  |  |   /// Shared preferences instance. | 
			
		
	
		
		
			
				
					
					|  |  |  |   /// |  |  |  |   /// | 
			
		
	
		
		
			
				
					
					|  |  |  |   /// Use [reqireDatabase] to access it. |  |  |  |   /// Use [database] to access it. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   /// Make sure it has been initialized wiht [init] before. |  |  |  |   /// Make sure it has been initialized wiht [init] before. | 
			
		
	
		
		
			
				
					
					|  |  |  |   static SharedPreferences? _sharedPreferences; |  |  |  |   static SharedPreferences? _sharedPreferences; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   /// Sets up the [SharedPreferences] instance. |  |  |  |   /// Sets up the [SharedPreferences] instance. | 
			
		
	
		
		
			
				
					
					|  |  |  |   /// |  |  |  |   /// | 
			
		
	
		
		
			
				
					
					|  |  |  |   /// Required to be called before accessing [reqireDatabase]. |  |  |  |   /// Required to be called before accessing [database]. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   static Future init() async { |  |  |  |   static Future init() async { | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (_sharedPreferences != null) { |  |  |  |     if (_sharedPreferences != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       return; |  |  |  |       return; | 
			
		
	
	
		
		
			
				
					|  |  | @ -40,37 +35,45 @@ class AppStorage implements SettingsStorage { | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @visibleForTesting |  |  |  |   @visibleForTesting | 
			
		
	
		
		
			
				
					
					|  |  |  |   static SharedPreferences get reqireDatabase { |  |  |  |   static SharedPreferences get database { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (_sharedPreferences == null) { |  |  |  |     if (_sharedPreferences == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       throw StateError( |  |  |  |       throw StateError( | 
			
		
	
		
		
			
				
					
					|  |  |  |         'AppStorage has not been initialized yet. Please make sure AppStorage.init() has been called before and completed.', |  |  |  |         'NeonStorage has not been initialized yet. Please make sure NeonStorage.init() has been called before and completed.', | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       ); |  |  |  |       ); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     return _sharedPreferences!; |  |  |  |     return _sharedPreferences!; | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @immutable | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | @internal | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | class AppStorage implements SettingsStorage { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   const AppStorage(this._id); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   final String _id; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   String _formatKey(final String key) => '$_id-$key'; |  |  |  |   String _formatKey(final String key) => '$_id-$key'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   bool containsKey(final String key) => reqireDatabase.containsKey(_formatKey(key)); |  |  |  |   bool containsKey(final String key) => NeonStorage.database.containsKey(_formatKey(key)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future<bool> remove(final String key) => reqireDatabase.remove(_formatKey(key)); |  |  |  |   Future<bool> remove(final String key) => NeonStorage.database.remove(_formatKey(key)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   String? getString(final String key) => reqireDatabase.getString(_formatKey(key)); |  |  |  |   String? getString(final String key) => NeonStorage.database.getString(_formatKey(key)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future setString(final String key, final String value) => reqireDatabase.setString(_formatKey(key), value); |  |  |  |   Future setString(final String key, final String value) => NeonStorage.database.setString(_formatKey(key), value); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   bool? getBool(final String key) => reqireDatabase.getBool(_formatKey(key)); |  |  |  |   bool? getBool(final String key) => NeonStorage.database.getBool(_formatKey(key)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   @override |  |  |  |   @override | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future setBool(final String key, final bool value) => reqireDatabase.setBool(_formatKey(key), value); |  |  |  |   Future setBool(final String key, final bool value) => NeonStorage.database.setBool(_formatKey(key), value); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   List<String>? getStringList(final String key) => reqireDatabase.getStringList(_formatKey(key)); |  |  |  |   List<String>? getStringList(final String key) => NeonStorage.database.getStringList(_formatKey(key)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   Future setStringList(final String key, final List<String> value) => |  |  |  |   Future setStringList(final String key, final List<String> value) => | 
			
		
	
		
		
			
				
					
					|  |  |  |       reqireDatabase.setStringList(_formatKey(key), value); |  |  |  |       NeonStorage.database.setStringList(_formatKey(key), value); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |