MergeJson class final

Deep-merges sourceData into the JSON file at targetPath.

When additive is true (the default), existing keys in the target file are preserved and only new keys are inserted. When false, conflicting keys are overwritten by the source value.

Example

MergeJson(
  targetPath: 'assets/lang/en.json',
  sourceData: {'errors': {'notFound': 'Not found.'}},
)
Inheritance

Constructors

MergeJson({required String targetPath, required Map<String, dynamic> sourceData, bool additive = true})
Creates a MergeJson operation.
const

Properties

additive bool
When true, existing keys are preserved (additive merge). When false, conflicting keys are overwritten.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceData Map<String, dynamic>
Data to merge into the target file.
final
targetPath String
Path to the target JSON file, relative to the project root.
final

Methods

describe() String
Returns a human-readable dry-run line for this operation.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited