getSingleScalarMap function
ScalarMap?
getSingleScalarMap(
- GeneratorOptions options,
- String type, {
- bool throwOnNotFound = true,
Retrieve a scalar mapping of a type.
Implementation
ScalarMap? getSingleScalarMap(GeneratorOptions options, String type,
{bool throwOnNotFound = true}) {
final scalarMap =
options.scalarMapping.followedBy(_defaultScalarMapping.values).firstWhere(
(m) => m!.graphQLType == type,
orElse: () => null,
);
if (throwOnNotFound && scalarMap == null) {
throw MissingScalarConfigurationException(type);
}
return scalarMap;
}