map<K> method

Codable<Map<K, T>> map<K>([
  1. Codable<K>? keyCodable
])

Returns a Codable that can encode and decode a map of K and T.

This let's you use any format extensions with maps:

final Map<String, Person> people = Person.codable.map().fromJson(...);
final String json = Person.codable.map().toJson(people);

Optionally you can provide a keyCodable to specify how to encode and decode the keys.

final Map<Uri, Person> people = Person.codable.map(Uri.codable).fromJson(...);
final String json = Person.codable.map(Uri.codable).toJson(people);

Implementation

Codable<Map<K, T>> map<K>([Codable<K>? keyCodable]) => MapCodable(keyCodable, this);