copyWith method

  1. @override
TurtleEncoderOptions copyWith({
  1. Map<String, String>? customPrefixes,
  2. bool? generateMissingPrefixes,
  3. bool? useNumericLocalNames,
  4. bool? includeBaseDeclaration,
  5. bool? renderFragmentsAsPrefixed,
  6. bool? prettyPrintCollections,
  7. int? collectionItemBreakAfter,
  8. int? objectListBreakAfter,
  9. int? inlineBlankNodeMaxWidth,
  10. int? inlineBlankNodeMaxTriples,
  11. IriRelativizationOptions? iriRelativization,
})
override

This method allows creating a new TurtleEncoderOptions instance based on the current options, selectively overriding specific fields while keeping all other settings unchanged.

Parameters:

  • customPrefixes Optional replacement for the custom namespace prefixes
  • generateMissingPrefixes Optional replacement for the automatic prefix generation setting
  • useNumericLocalNames Optional replacement for the numeric local names handling setting
  • includeBaseDeclaration Optional replacement for the base declaration inclusion setting
  • renderFragmentsAsPrefixed Optional replacement for the fragment rendering setting

Returns:

  • A new TurtleEncoderOptions instance with the specified changes applied

Example:

final originalOptions = TurtleEncoderOptions(
  generateMissingPrefixes: true,
  useNumericLocalNames: false
);

final modifiedOptions = originalOptions.copyWith(
  generateMissingPrefixes: false,
  customPrefixes: {'ex': 'http://example.org/'}
);

Implementation

@override
TurtleEncoderOptions copyWith(
        {Map<String, String>? customPrefixes,
        bool? generateMissingPrefixes,
        bool? useNumericLocalNames,
        bool? includeBaseDeclaration,
        bool? renderFragmentsAsPrefixed,
        bool? prettyPrintCollections,
        int? collectionItemBreakAfter,
        int? objectListBreakAfter,
        int? inlineBlankNodeMaxWidth,
        int? inlineBlankNodeMaxTriples,
        IriRelativizationOptions? iriRelativization}) =>
    TurtleEncoderOptions(
      customPrefixes: customPrefixes ?? this.customPrefixes,
      generateMissingPrefixes:
          generateMissingPrefixes ?? this.generateMissingPrefixes,
      useNumericLocalNames: useNumericLocalNames ?? this.useNumericLocalNames,
      includeBaseDeclaration:
          includeBaseDeclaration ?? this.includeBaseDeclaration,
      renderFragmentsAsPrefixed:
          renderFragmentsAsPrefixed ?? this.renderFragmentsAsPrefixed,
      prettyPrintCollections:
          prettyPrintCollections ?? this.prettyPrintCollections,
      collectionItemBreakAfter:
          collectionItemBreakAfter ?? this.collectionItemBreakAfter,
      objectListBreakAfter: objectListBreakAfter ?? this.objectListBreakAfter,
      inlineBlankNodeMaxWidth:
          inlineBlankNodeMaxWidth ?? this.inlineBlankNodeMaxWidth,
      inlineBlankNodeMaxTriples:
          inlineBlankNodeMaxTriples ?? this.inlineBlankNodeMaxTriples,
      iriRelativization: iriRelativization ?? this.iriRelativization,
    );