JsonEnumConverter<E extends Enum, S>.withCache constructor

const JsonEnumConverter<E extends Enum, S>.withCache()

Creates a new JsonEnumConverter, holds an internal cache that maps each enum value to a its converted json value, as per toJson.

Using a cached JsonEnumConverter may be more efficient, if the enum E has many values, or if there are a lot of conversions.

The cache is shared by all JsonEnumConverter of type E.

Implementation

const JsonEnumConverter.withCache() : _useCache = true;