Skip to content

Commit ede7b25

Browse files
committed
nullable key for _getValue
1 parent 9590615 commit ede7b25

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/src/keyed_archive.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class KeyedArchive extends Object
131131
_map[key] = value;
132132
}
133133

134-
dynamic operator [](Object? key) => _getValue(key as String);
134+
dynamic operator [](Object? key) => _getValue(key as String?);
135135

136136
Iterable<String> get keys => _map.keys;
137137

@@ -153,7 +153,7 @@ class KeyedArchive extends Object
153153
return out;
154154
}
155155

156-
dynamic _getValue(String key) {
156+
dynamic _getValue(String? key) {
157157
if (_map.containsKey(key)) {
158158
return _map[key];
159159
}
@@ -228,7 +228,7 @@ class KeyedArchive extends Object
228228
/// If this object is a reference to another object (via [referenceURI]), this object's key-value
229229
/// pairs will be searched first. If [key] is not found, the referenced object's key-values pairs are searched.
230230
/// If no match is found, null is returned.
231-
T? decode<T>(String key) {
231+
T? decode<T>(String? key) {
232232
var v = _getValue(key);
233233
if (v == null) {
234234
return null;
@@ -248,7 +248,7 @@ class KeyedArchive extends Object
248248
/// [inflate] must create an empty instance of [T]. The value associated with [key]
249249
/// must be a [KeyedArchive] (a [Map]). The values of the associated object are read into
250250
/// the empty instance of [T].
251-
T? decodeObject<T extends Coding>(String key, T inflate()) {
251+
T? decodeObject<T extends Coding>(String? key, T inflate()) {
252252
final val = _getValue(key);
253253
if (val == null) {
254254
return null;
@@ -287,7 +287,7 @@ class KeyedArchive extends Object
287287
/// must be a [KeyedArchive] (a [Map]), where each value is a [T].
288288
/// For each key-value pair of the archived map, [inflate] is invoked and
289289
/// each value is decoded into the instance of [T].
290-
Map<String, T?>? decodeObjectMap<T extends Coding>(String key, T inflate()) {
290+
Map<String, T?>? decodeObjectMap<T extends Coding>(String? key, T inflate()) {
291291
var v = _getValue(key);
292292
if (v == null) {
293293
return null;

0 commit comments

Comments
 (0)