@@ -69,8 +69,10 @@ class DependencyServicesReportCommand extends PubCommand {
69
69
} else {
70
70
final resolution = await _tryResolve (entrypoint.root.pubspec, cache) ??
71
71
(throw DataException ('Failed to resolve pubspec' ));
72
- currentPackages =
73
- Map <String , PackageId >.fromIterable (resolution, key: (e) => e.name);
72
+ currentPackages = Map <String , PackageId >.fromIterable (
73
+ resolution,
74
+ key: (e) => (e as PackageId ).name,
75
+ );
74
76
}
75
77
currentPackages.remove (entrypoint.root.name);
76
78
@@ -361,13 +363,13 @@ class DependencyServicesApplyCommand extends PubCommand {
361
363
YamlEditor (readTextFile (entrypoint.pubspecPath));
362
364
final toApply = < _PackageVersion > [];
363
365
final input = json.decode (await utf8.decodeStream (stdin));
364
- for (final change in input['dependencyChanges' ]) {
366
+ for (final change in input['dependencyChanges' ] as Iterable ) {
365
367
toApply.add (
366
368
_PackageVersion (
367
- change['name' ],
368
- change['version' ],
369
+ change['name' ] as String ,
370
+ change['version' ] as String ? ,
369
371
change['constraint' ] != null
370
- ? VersionConstraint .parse (change['constraint' ])
372
+ ? VersionConstraint .parse (change['constraint' ] as String )
371
373
: null ,
372
374
),
373
375
);
@@ -421,23 +423,23 @@ class DependencyServicesApplyCommand extends PubCommand {
421
423
}
422
424
if (lockFileEditor != null ) {
423
425
if (targetVersion != null &&
424
- lockFileYaml['packages' ].containsKey (targetPackage)) {
426
+ ( lockFileYaml['packages' ] as Map ) .containsKey (targetPackage)) {
425
427
lockFileEditor.update (
426
428
['packages' , targetPackage, 'version' ],
427
429
targetVersion.toString (),
428
430
);
429
431
// Remove the now outdated content-hash - it will be restored below
430
432
// after resolution.
431
- if ( lockFileEditor
432
- .parseAt (['packages' , targetPackage, 'description' ])
433
- .value
434
- . containsKey ( 'sha256' ) ) {
433
+ var packageMap = lockFileEditor
434
+ .parseAt (['packages' , targetPackage, 'description' ]).value as Map ;
435
+ var hasSha = packageMap. containsKey ( 'sha256' );
436
+ if (hasSha ) {
435
437
lockFileEditor.remove (
436
438
['packages' , targetPackage, 'description' , 'sha256' ],
437
439
);
438
440
}
439
441
} else if (targetRevision != null &&
440
- lockFileYaml['packages' ].containsKey (targetPackage)) {
442
+ ( lockFileYaml['packages' ] as Map ) .containsKey (targetPackage)) {
441
443
final ref = entrypoint.lockFile.packages[targetPackage]! .toRef ();
442
444
final currentDescription = ref.description as GitDescription ;
443
445
final updatedRef = PackageRef (
@@ -468,7 +470,7 @@ class DependencyServicesApplyCommand extends PubCommand {
468
470
);
469
471
} else if (targetVersion == null &&
470
472
targetRevision == null &&
471
- ! lockFileYaml['packages' ].containsKey (targetPackage)) {
473
+ ! ( lockFileYaml['packages' ] as Map ) .containsKey (targetPackage)) {
472
474
dataError (
473
475
'Trying to remove non-existing transitive dependency $targetPackage .' ,
474
476
);
0 commit comments