File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,14 @@ class Hint {
8383 // Key/Value Storage
8484
8585 void addAll (Map <String , dynamic > keysAndValues) {
86- _internalStorage.addAll (keysAndValues);
86+ final withoutNullValues = keysAndValues.map (
87+ (key, value) => MapEntry (key, value ?? "null" )
88+ );
89+ _internalStorage.addAll (withoutNullValues);
8790 }
8891
8992 void set (String key, dynamic value) {
90- _internalStorage[key] = value;
93+ _internalStorage[key] = value ?? "null" ;
9194 }
9295
9396 dynamic get (String key) {
Original file line number Diff line number Diff line change @@ -82,6 +82,23 @@ void main() {
8282 expect (sut.screenshot, attachment);
8383 expect (sut.viewHierarchy, attachment);
8484 });
85+
86+ test ('Hint init with map null fallback' , () {
87+ final hint = Hint .withMap ({'fixture-key' : null });
88+ expect ("null" , hint.get ("fixture-key" ));
89+ });
90+
91+ test ('Hint addAll with map null fallback' , () {
92+ final hint = Hint ();
93+ hint.addAll ({'fixture-key' : null });
94+ expect ("null" , hint.get ("fixture-key" ));
95+ });
96+
97+ test ('Hint set with null value fallback' , () {
98+ final hint = Hint ();
99+ hint.set ("fixture-key" , null );
100+ expect ("null" , hint.get ("fixture-key" ));
101+ });
85102}
86103
87104class Fixture {
You can’t perform that action at this time.
0 commit comments