TrivialComparator class

Placeholder comparator that is set as the value of goldenFileComparator when the initialization that happens in the test bootstrap either has not yet happened or has been bypassed.

The test bootstrap file that gets generated by the Flutter tool when the user runs flutter test is expected to set goldenFileComparator to a comparator that resolves golden file references relative to the test directory. From there, the caller may choose to override the comparator by setting it to another value during test initialization. The only case where we expect it to remain uninitialized is when the user runs a test via flutter run. In this case, the compare method will just print a message that it would have otherwise run a real comparison, and it will return trivial success.

This class can't be constructed. It represents the default value of goldenFileComparator.

Implemented types


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


compare(Uint8List imageBytes, Uri golden) Future<bool>
Compares the pixels of decoded png imageBytes against the golden file identified by golden.
getTestUri(Uri key, int? version) Uri
Returns a new golden file Uri to incorporate any version number with the key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.
update(Uri golden, Uint8List imageBytes) Future<void>
Updates the golden file identified by golden with imageBytes.


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