Skip to content

Commit ba3e258

Browse files
Merge pull request #795 from Workiva/add-jsifyMapListProp-utils
FED-580 Add `jsifyMapListProp` and `unjsifyMapListProp` conversion utils
2 parents 4a07ec5 + f5abcf2 commit ba3e258

File tree

4 files changed

+389
-9
lines changed

4 files changed

+389
-9
lines changed

lib/src/util/prop_conversion.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ Map<K, V> unjsifyMapProp<K, V>(JsMap value) {
5151
return JsBackedMap.backedBy(value).cast();
5252
}
5353

54+
/// Runs [jsifyMapProp] on every Dart Map in the [value].
55+
List<JsMap> jsifyMapListProp(List<Map> value) {
56+
return value?.map(jsifyMapProp)?.toList();
57+
}
58+
59+
/// Runs [unjsifyMapProp] on every JS Map in the [value].
60+
List<Map<K, V>> unjsifyMapListProp<K, V>(List<dynamic> value) {
61+
return value?.map((e) => unjsifyMapProp<K, V>(e as JsMap))?.toList();
62+
}
63+
5464
/// Returns [value] converted to its JS ref representation for storage in a props map, or null of the [value] is null.
5565
///
5666
/// For use in JS component prop getters where the component expects a JS ref, but accepting Dart refs

0 commit comments

Comments
 (0)