Skip to content

Instantly share code, notes, and snippets.

@ayansg
Last active January 28, 2023 17:10
Show Gist options
  • Save ayansg/4872b0b0611a38f2036d43fdf40c2575 to your computer and use it in GitHub Desktop.
Save ayansg/4872b0b0611a38f2036d43fdf40c2575 to your computer and use it in GitHub Desktop.
typedef RawDocument = Map<String,dynamic>;
typedef RawCollection = Iterable<RawDocument>;
void main() async {
final y = await _getIterable();
print(y);
print(y.runtimeType);
}
Future<RawCollection> _getIterable() async {
final Iterable<Map<Object?,dynamic>> list = [ //Iterable<Map> should also work
{
"x":5,
"y":"hi",
},
{
"x":6,
"y":"hello",
}
];
return await Future.value(list.map((e)=>e.cast<String,dynamic>()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment