@@ -15,6 +15,7 @@ import 'package:dart_services/src/sdk.dart';
15
15
import 'package:dart_services/src/utils.dart' ;
16
16
import 'package:grinder/grinder.dart' ;
17
17
import 'package:http/http.dart' as http;
18
+ import 'package:package_config/package_config.dart' ;
18
19
import 'package:path/path.dart' as path;
19
20
20
21
Future <void > main (List <String > args) async {
@@ -209,25 +210,18 @@ Future<String> _buildStorageArtifacts(Directory dir, Sdk sdk,
209
210
final flutterPackages = ['flutter' , 'flutter_test' ];
210
211
211
212
final flutterLibraries = < String > [];
212
- final packageLines = joinFile (dir, ['.packages' ]).readAsLinesSync ();
213
- for (var line in packageLines) {
214
- line = line.trim ();
215
- if (line.startsWith ('#' ) || line.isEmpty) {
216
- continue ;
217
- }
218
- final index = line.indexOf (':' );
219
- if (index == - 1 ) {
220
- continue ;
221
- }
222
- final packageName = line.substring (0 , index);
223
- final url = line.substring (index + 1 );
224
- if (flutterPackages.contains (packageName)) {
213
+ final config = await findPackageConfig (dir);
214
+ if (config == null ) {
215
+ throw FileSystemException ('package config not found' , dir.toString ());
216
+ }
217
+ for (final package in config.packages) {
218
+ if (flutterPackages.contains (package.name)) {
225
219
// This is a package we're interested in - add all the public libraries to
226
220
// the list.
227
- final libPath = Uri . parse (url) .toFilePath ();
221
+ final libPath = package.packageUriRoot .toFilePath ();
228
222
for (final entity in getDir (libPath).listSync ()) {
229
223
if (entity is File && entity.path.endsWith ('.dart' )) {
230
- flutterLibraries.add ('package:$packageName /${fileName (entity )}' );
224
+ flutterLibraries.add ('package:${ package . name } /${fileName (entity )}' );
231
225
}
232
226
}
233
227
}
@@ -254,7 +248,6 @@ Future<String> _buildStorageArtifacts(Directory dir, Sdk sdk,
254
248
'-s' ,
255
249
dillPath,
256
250
'--sound-null-safety' ,
257
- '--enable-experiment=non-nullable' ,
258
251
'--modules=amd' ,
259
252
'--source-map' ,
260
253
'-o' ,
0 commit comments