Skip to content

Commit

Permalink
[shared_preferences] Add test to enforce mutable lists (flutter#7369)
Browse files Browse the repository at this point in the history
Just a test :)
  • Loading branch information
tarrinneal authored Aug 27, 2024
1 parent ce17b4b commit bcb09db
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ void main() {
expect(await preferences.getStringList(listKey), testList);
});

testWidgets('getStringList returns mutable list', (WidgetTester _) async {
final SharedPreferencesAsync preferences = await getPreferences();

await preferences.setStringList(listKey, testList);
final List<String>? list = await preferences.getStringList(listKey);
list?.add('value');
expect(list?.length, testList.length + 1);
});

testWidgets('getAll', (WidgetTester _) async {
final SharedPreferencesAsync preferences = await getPreferences();
await Future.wait(<Future<void>>[
Expand Down

0 comments on commit bcb09db

Please sign in to comment.