moved encode_map to util.dart