@@ -11,6 +11,7 @@ import 'package:file/file.dart';
1111import 'package:file/local.dart' ;
1212import 'package:flutter/foundation.dart' ;
1313import 'package:flutter_test/flutter_test.dart' ;
14+ import 'package:path/path.dart' as path;
1415import 'package:yaml/yaml.dart' ;
1516
1617/// Main method that can be used in a `flutter_test_config.dart` file to set
@@ -100,7 +101,9 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
100101 }) {
101102 final Directory comparisonRoot = switch (suffix) {
102103 null =>
103- fs.directory (defaultComparator.basedir).childDirectory ('skia_goldens' ),
104+ fs
105+ .directory (path.fromUri (defaultComparator.basedir))
106+ .childDirectory ('skia_goldens' ),
104107 _ => fs.systemTempDirectory.createTempSync (suffix),
105108 };
106109 return comparisonRoot;
@@ -109,7 +112,9 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
109112 /// Returns the golden [File] identified by the given [Uri] .
110113 @protected
111114 File getGoldenFile (Uri uri) {
112- final File goldenFile = fs.directory (basedir).childFile (fs.file (uri).path);
115+ final File goldenFile = fs
116+ .directory (path.fromUri (basedir))
117+ .childFile (path.fromUri (uri));
113118
114119 return goldenFile;
115120 }
@@ -122,8 +127,10 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
122127 final File pubspec = current.childFile ('pubspec.yaml' );
123128 if (pubspec.existsSync ()) {
124129 try {
125- final yaml = loadYaml (pubspec.readAsStringSync ()) as YamlMap ;
126- return yaml['name' ] as String ? ;
130+ final Object ? yaml = loadYaml (pubspec.readAsStringSync ());
131+ if (yaml is YamlMap ) {
132+ return yaml['name' ] as String ? ;
133+ }
127134 } catch (e) {
128135 // Ignore parsing errors and keep looking
129136 }
0 commit comments