anchor.diff:          await pub.get(context: PubContext.flutterTests, checkLastModified: true);
           expect(true, isFalse, reason: 'pub.get did not throw');
         } catch (error) {
  -        expect(error.runtimeType, Exception);
  +        expect(error, isInstanceOf<Exception>());
           expect(error.message, '/: unexpected concurrent modification of pubspec.yaml while running pub.');
         }
         expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
  
positive.code:             ..setLastModifiedSync(DateTime(2002));
          }
        ),
      ]);
      Testbed().run(() async {
        // the good scenario: .packages is old, pub updates the file.
        fs.file('.packages')
          ..createSync()
  
negative.code:     Pub: () => const Pub(),
    });
  
    test('Pub error handling', () async {
      final MemoryFileSystem fileSystem = MemoryFileSystem();
      final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
        FakeCommand(
  