Web-specific golden comparisons are no longer supported
Summary
#
                  The flutter_test package and flutter tool will no longer use the
                  webGoldenComparator
                   top-level variable, and instead use the original
                  goldenFileComparator
                   top-level variable (like the non-web platforms).
                
For users of flutter_test, these changes will be made automatically.
Background
#
                  Originally, WebGoldenComparator
                   was added for
                  the HTML-backend of Flutter web, as it was not possible to create an encoded
                  PNG (byte buffer), and a new API was needed. As the HTML backend is being
                    deprecated and removed, this separate API is no longer necessary.
                
Migration guide
#
                  For most users, no changes are required (other than migrating off the HTML
                  backend, which is not covered here), the flutter tool will automatically
                  configure goldenFileComparator
                   and use it (when using a non-HTML web
                  backend).
                
                  For users that implement a custom WebGoldenComparator, you will
                  migrate the implemenation to GoldenFileComparator. Fortunately the
                  Canvas Kit and SkWasm backends already required similar methods (compareButes
                  
                  and updateBytes).
                
For example:
// Before
class MyWebGoldenComparator extends WebGoldenComparator {
  @override
  Future<bool> compare(double width, double height, Uri golden) {
    // will be removed in the migration
  }
  @override
  Future<bool> update(double width, double height, Uri golden) {
    // will be removed in the migration
  }
  @override
  Future<bool> compareBytes(Uint8List bytes, Uri golden) {
    // will be renamed "compare"
  }
  @override
  Future<bool> updateBytes(Uint8List bytes, Uri golden) {
    // will be renamed "update" and the parameter orders swapped
  }
}
// After
class MyGenericGoldenComparator extends GoldenFileComparator {
  @override
  Future<bool> compare(Uint8List bytes, Uri golden) {
    // used to be "compareBytes"
  }
  @override
  Future<bool> update(Uri golden, Uint8List bytes) {
    // used to be "updateBytes"
  }
}
                    
                    
                    
                  Timeline
#
                  Landed in version: 3.29.0-0.0.pre
                  In stable release: 3.29
                
References
#Relevant Issues:
- Issue 145954, where the HTML renderer was deprecated.
 - 
                    Issue 160261, where it was proposed to consolidate 
                    
GoldenFileComparatorandWebGoldenComparator. 
Relevant PRs:
- 
                    PR 161196, where 
WebGoldenComparatorwas deprecated and theflutterCLI started usinggoldenFileComparator. 
Unless stated otherwise, the documentation on this site reflects Flutter 3.35.5. Page last updated on 2025-10-28. View source or report an issue.