withDefaults method

  1. @Deprecated('Was only ever included to support builder infrastructure.')
JsonSerializable withDefaults()

Returns a new JsonSerializable instance with fields equal to the corresponding values in this, if not null.

Otherwise, the returned value has the default value as defined in defaults.

Implementation

@Deprecated('Was only ever included to support builder infrastructure.')
JsonSerializable withDefaults() => JsonSerializable(
  anyMap: anyMap ?? defaults.anyMap,
  checked: checked ?? defaults.checked,
  constructor: constructor ?? defaults.constructor,
  createFactory: createFactory ?? defaults.createFactory,
  createToJson: createToJson ?? defaults.createToJson,
  disallowUnrecognizedKeys:
      disallowUnrecognizedKeys ?? defaults.disallowUnrecognizedKeys,
  explicitToJson: explicitToJson ?? defaults.explicitToJson,
  fieldRename: fieldRename ?? defaults.fieldRename,
  ignoreUnannotated: ignoreUnannotated ?? defaults.ignoreUnannotated,
  includeIfNull: includeIfNull ?? defaults.includeIfNull,
  genericArgumentFactories:
      genericArgumentFactories ?? defaults.genericArgumentFactories,
);