resolve static method

BaseChartConfig resolve(
  1. Map<String, dynamic> json
)

Resolve a BaseChartConfig from a JSON map.

Looks up json['type'] in the registry. Throws UnregisteredChartTypeException if the type has not been registered.

This replaces the getChartConfig() switch in helper.dart.

Implementation

static BaseChartConfig resolve(Map<String, dynamic> json) {
  final typeStr = _typeKey(json['type']);
  final reg = _registrationForKey(typeStr);
  if (reg == null) {
    throw UnregisteredChartTypeException(
      typeStr,
      registeredTypes,
      suggestions: suggestTypeStrings(typeStr),
    );
  }
  return reg.fromJson(json);
}