yMapEntries method
Implementation
List<
(
String,
YValue,
)> yMapEntries({
required YMap ref,
YTransaction? txn,
}) {
final results = _yMapEntries([
ref.toWasm(),
(txn == null
? const None().toWasm()
: Option.fromValue(txn).toWasm(YTransaction.toWasm))
]);
final result = results[0];
return (result! as Iterable)
.map((e) => (() {
final l = e is Map
? List.generate(2, (i) => e[i.toString()], growable: false)
: e;
return switch (l) {
[final v0, final v1] || (final v0, final v1) => (
v0 is String ? v0 : (v0! as ParsedString).value,
YValue.fromJson(v1),
),
_ => throw Exception('Invalid JSON $e')
};
})())
.toList();
}