Skip to content

Commit 490ea77

Browse files
committed
++
1 parent cbf2e7a commit 490ea77

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/material_ui/test/goldens/goldens_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:flutter/cupertino.dart';
65
import 'package:flutter/foundation.dart';
6+
import 'package:flutter/material.dart';
77
import 'package:flutter_test/flutter_test.dart';
88
import 'package:material_ui/material_ui.dart';
99

script/flutter_goldens/lib/flutter_goldens.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:file/file.dart';
1111
import 'package:file/local.dart';
1212
import 'package:flutter/foundation.dart';
1313
import 'package:flutter_test/flutter_test.dart';
14+
import 'package:path/path.dart' as path;
1415
import '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

Comments
 (0)