Skip to content

Commit

Permalink
add test to enforce mutable lists
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrinneal committed Aug 12, 2024
1 parent 4b00343 commit 260e00f
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 260e00f

Please sign in to comment.