Skip to content

Instantly share code, notes, and snippets.

@kwmt
Created October 13, 2018 04:20
Show Gist options
  • Save kwmt/6d48e7bc264ae588d1b083cf6ca3c61a to your computer and use it in GitHub Desktop.
Save kwmt/6d48e7bc264ae588d1b083cf6ca3c61a to your computer and use it in GitHub Desktop.
JSON serialize Map<String, bool>
void main() {
// サンプルデータ
Map<String, bool> members = Map<String, bool>()
..putIfAbsent("userID1", () => true)
..putIfAbsent("userID2", () => true);
print(members);
var transMember = members.entries.map((member) {
return <String, dynamic>{member.key: member.value};
});
print(transMember);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment