enable avoid_single_cascade_in_expression_statements (#51944)
This commit is contained in:
parent
3018d8ddb3
commit
c2ae654ddf
@ -79,7 +79,7 @@ linter:
|
||||
# - avoid_returning_this # there are plenty of valid reasons to return this
|
||||
# - avoid_setters_without_getters # not yet tested
|
||||
# - avoid_shadowing_type_parameters # not yet tested
|
||||
# - avoid_single_cascade_in_expression_statements # not yet tested
|
||||
- avoid_single_cascade_in_expression_statements
|
||||
- avoid_slow_async_io
|
||||
- avoid_types_as_parameter_names
|
||||
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
|
||||
|
@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Does flutter_test catch leaking tickers?', (WidgetTester tester) async {
|
||||
Ticker((Duration duration) { })..start();
|
||||
Ticker((Duration duration) { }).start();
|
||||
|
||||
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
||||
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
||||
|
@ -193,8 +193,7 @@ class _PointDemoState extends State<_PointDemo> {
|
||||
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
||||
() => ImmediateMultiDragGestureRecognizer(),
|
||||
(ImmediateMultiDragGestureRecognizer instance) {
|
||||
instance
|
||||
..onStart = _handleOnStart;
|
||||
instance.onStart = _handleOnStart;
|
||||
},
|
||||
),
|
||||
},
|
||||
@ -366,8 +365,7 @@ class _RectangleDemoState extends State<_RectangleDemo> {
|
||||
ImmediateMultiDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<ImmediateMultiDragGestureRecognizer>(
|
||||
() => ImmediateMultiDragGestureRecognizer(),
|
||||
(ImmediateMultiDragGestureRecognizer instance) {
|
||||
instance
|
||||
..onStart = _handleOnStart;
|
||||
instance.onStart = _handleOnStart;
|
||||
},
|
||||
),
|
||||
},
|
||||
|
@ -188,16 +188,14 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
_borderColorTween
|
||||
..end = theme.dividerColor;
|
||||
_borderColorTween.end = theme.dividerColor;
|
||||
_headerColorTween
|
||||
..begin = theme.textTheme.subtitle1.color
|
||||
..end = theme.accentColor;
|
||||
_iconColorTween
|
||||
..begin = theme.unselectedWidgetColor
|
||||
..end = theme.accentColor;
|
||||
_backgroundColorTween
|
||||
..end = widget.backgroundColor;
|
||||
_backgroundColorTween.end = widget.backgroundColor;
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
|
@ -563,8 +563,7 @@ class _ChildOverflowBox extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, _RenderChildOverflowBox renderObject) {
|
||||
renderObject
|
||||
..textDirection = Directionality.of(context);
|
||||
renderObject.textDirection = Directionality.of(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,7 @@ class InkRipple extends InteractiveInkFeature {
|
||||
..forward();
|
||||
// This confirm may have been preceded by a cancel.
|
||||
_fadeInController.forward();
|
||||
_fadeOutController
|
||||
..animateTo(1.0, duration: _kFadeOutDuration);
|
||||
_fadeOutController.animateTo(1.0, duration: _kFadeOutDuration);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -581,8 +581,7 @@ class PaintingContext extends ClipContext {
|
||||
..save()
|
||||
..transform(effectiveTransform.storage);
|
||||
painter(this, offset);
|
||||
canvas
|
||||
..restore();
|
||||
canvas.restore();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -24,8 +24,7 @@ mixin ServicesBinding on BindingBase {
|
||||
super.initInstances();
|
||||
_instance = this;
|
||||
_defaultBinaryMessenger = createBinaryMessenger();
|
||||
window
|
||||
..onPlatformMessage = defaultBinaryMessenger.handlePlatformMessage;
|
||||
window.onPlatformMessage = defaultBinaryMessenger.handlePlatformMessage;
|
||||
initLicenses();
|
||||
SystemChannels.system.setMessageHandler(handleSystemMessage);
|
||||
}
|
||||
|
@ -1306,8 +1306,7 @@ class CompositedTransformTarget extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, RenderLeaderLayer renderObject) {
|
||||
renderObject
|
||||
..link = link;
|
||||
renderObject.link = link;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4993,8 +4992,7 @@ class Flow extends MultiChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, RenderFlow renderObject) {
|
||||
renderObject
|
||||
..delegate = delegate;
|
||||
renderObject.delegate = delegate;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class ColorFiltered extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, _ColorFilterRenderObject renderObject) {
|
||||
renderObject..colorFilter = colorFilter;
|
||||
renderObject.colorFilter = colorFilter;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -624,8 +624,7 @@ class GestureDetector extends StatelessWidget {
|
||||
gestures[DoubleTapGestureRecognizer] = GestureRecognizerFactoryWithHandlers<DoubleTapGestureRecognizer>(
|
||||
() => DoubleTapGestureRecognizer(debugOwner: this),
|
||||
(DoubleTapGestureRecognizer instance) {
|
||||
instance
|
||||
..onDoubleTap = onDoubleTap;
|
||||
instance.onDoubleTap = onDoubleTap;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class ImageFiltered extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, _ImageFilterRenderObject renderObject) {
|
||||
renderObject..imageFilter = imageFilter;
|
||||
renderObject.imageFilter = imageFilter;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -63,8 +63,7 @@ class _ImageFilterRenderObject extends RenderProxyBox {
|
||||
layer = ImageFilterLayer(imageFilter: imageFilter);
|
||||
} else {
|
||||
final ImageFilterLayer filterLayer = layer as ImageFilterLayer;
|
||||
filterLayer
|
||||
..imageFilter = imageFilter;
|
||||
filterLayer.imageFilter = imageFilter;
|
||||
}
|
||||
context.pushLayer(layer, super.paint, offset);
|
||||
assert(layer != null);
|
||||
|
@ -168,7 +168,7 @@ abstract class Route<T> {
|
||||
// For example, ModalRoute create a focus scope in its overlay entries. The
|
||||
// focused child can only be attached to navigator after initState which
|
||||
// will be guarded by the asynchronous gap.
|
||||
TickerFuture.complete()..then<void>((void _) {
|
||||
TickerFuture.complete().then<void>((void _) {
|
||||
navigator.focusScopeNode.requestFocus();
|
||||
});
|
||||
}
|
||||
|
@ -1519,8 +1519,7 @@ class SliverOverlapAbsorber extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, RenderSliverOverlapAbsorber renderObject) {
|
||||
renderObject
|
||||
..handle = handle;
|
||||
renderObject.handle = handle;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1694,8 +1693,7 @@ class SliverOverlapInjector extends SingleChildRenderObjectWidget {
|
||||
|
||||
@override
|
||||
void updateRenderObject(BuildContext context, RenderSliverOverlapInjector renderObject) {
|
||||
renderObject
|
||||
..handle = handle;
|
||||
renderObject.handle = handle;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -287,12 +287,12 @@ void main() {
|
||||
test('Live image cache avoids leaks of unlistened streams', () async {
|
||||
imageCache.maximumSize = 3;
|
||||
|
||||
const TestImageProvider(1, 1)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(2, 2)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(3, 3)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(4, 4)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(5, 5)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(6, 6)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(1, 1).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(2, 2).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(3, 3).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(4, 4).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(5, 5).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(6, 6).resolve(ImageConfiguration.empty);
|
||||
|
||||
// wait an event loop to let image resolution process.
|
||||
await null;
|
||||
@ -304,12 +304,12 @@ void main() {
|
||||
test('Disabled image cache does not leak live images', () async {
|
||||
imageCache.maximumSize = 0;
|
||||
|
||||
const TestImageProvider(1, 1)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(2, 2)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(3, 3)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(4, 4)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(5, 5)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(6, 6)..resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(1, 1).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(2, 2).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(3, 3).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(4, 4).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(5, 5).resolve(ImageConfiguration.empty);
|
||||
const TestImageProvider(6, 6).resolve(ImageConfiguration.empty);
|
||||
|
||||
// wait an event loop to let image resolution process.
|
||||
await null;
|
||||
|
@ -122,8 +122,7 @@ void main() {
|
||||
TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
|
||||
() => TapGestureRecognizer(),
|
||||
(TapGestureRecognizer instance) {
|
||||
instance
|
||||
..onTap = () { logs.add('tap'); };
|
||||
instance.onTap = () { logs.add('tap'); };
|
||||
},
|
||||
),
|
||||
});
|
||||
@ -146,8 +145,7 @@ void main() {
|
||||
HorizontalDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<HorizontalDragGestureRecognizer>(
|
||||
() => HorizontalDragGestureRecognizer(),
|
||||
(HorizontalDragGestureRecognizer instance) {
|
||||
instance
|
||||
..onStart = (_) { logs.add('horizontal'); };
|
||||
instance.onStart = (_) { logs.add('horizontal'); };
|
||||
},
|
||||
),
|
||||
},
|
||||
|
@ -103,7 +103,7 @@ class AotBuilder {
|
||||
if ((await Future.wait<int>(exitCodes.values)).every((int buildExitCode) => buildExitCode == 0)) {
|
||||
final Iterable<String> dylibs = iosBuilds.values.map<String>(
|
||||
(String outputDir) => globals.fs.path.join(outputDir, 'App.framework', 'App'));
|
||||
globals.fs.directory(globals.fs.path.join(outputPath, 'App.framework'))..createSync();
|
||||
globals.fs.directory(globals.fs.path.join(outputPath, 'App.framework')).createSync();
|
||||
await processUtils.run(
|
||||
<String>[
|
||||
'lipo',
|
||||
|
@ -418,7 +418,7 @@ class LicenseCollector {
|
||||
licenseText = rawLicense;
|
||||
}
|
||||
packageLicenses.putIfAbsent(licenseText, () => <String>{})
|
||||
..addAll(packageNames);
|
||||
.addAll(packageNames);
|
||||
allPackages.addAll(packageNames);
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ Future<void> main() async {
|
||||
''';
|
||||
}
|
||||
environment.buildDir.childFile('main.dart')
|
||||
..writeAsStringSync(contents);
|
||||
.writeAsStringSync(contents);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,12 +134,12 @@ void main() {
|
||||
|
||||
// Project files.
|
||||
fileSystem.file('.packages')
|
||||
..writeAsStringSync('''
|
||||
.writeAsStringSync('''
|
||||
foo:lib/
|
||||
fizz:bar/lib/
|
||||
''');
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..writeAsStringSync('''
|
||||
.writeAsStringSync('''
|
||||
name: foo
|
||||
|
||||
dependencies:
|
||||
@ -167,7 +167,7 @@ flutter:
|
||||
class UrlLauncherPlugin {}
|
||||
''');
|
||||
fileSystem.file(fileSystem.path.join('lib', 'main.dart'))
|
||||
..writeAsStringSync('void main() { }');
|
||||
.writeAsStringSync('void main() { }');
|
||||
|
||||
// Process calls. We're not testing that these invocations are correct because
|
||||
// that is covered in targets/web_test.dart.
|
||||
|
@ -42,7 +42,7 @@ void main() {
|
||||
fs.currentDirectory = tempDir;
|
||||
fs.directory('test').createSync();
|
||||
fs.directory('test_driver').createSync();
|
||||
fs.file('pubspec.yaml')..createSync();
|
||||
fs.file('pubspec.yaml').createSync();
|
||||
fs.file('.packages').createSync();
|
||||
setExitFunctionForTests();
|
||||
appStarter = (DriveCommand command, Uri webUri) {
|
||||
|
@ -48,7 +48,7 @@ void main() {
|
||||
final GenerateCommand command = GenerateCommand();
|
||||
applyMocksToCommand(command);
|
||||
globals.fs.file(globals.fs.path.join('lib', 'main.dart'))
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
globals.fs.currentDirectory
|
||||
.childDirectory('.dart_tool')
|
||||
|
@ -58,7 +58,7 @@ void main() {
|
||||
void _populateDir(Map<String, String> manifest) {
|
||||
for (final String key in manifest.keys) {
|
||||
if (manifest[key] == 'dir') {
|
||||
tempDir.childDirectory(key)..createSync(recursive: true);
|
||||
tempDir.childDirectory(key).createSync(recursive: true);
|
||||
}
|
||||
}
|
||||
for (final String key in manifest.keys) {
|
||||
|
@ -156,9 +156,9 @@ void main() {
|
||||
fs.currentDirectory = tempDir;
|
||||
|
||||
tempDir.childFile('pubspec.yaml')
|
||||
..writeAsStringSync('name: flutter_app');
|
||||
.writeAsStringSync('name: flutter_app');
|
||||
tempDir.childFile('.packages')
|
||||
..writeAsStringSync('# Generated by pub on 2019-11-25 12:38:01.801784.');
|
||||
.writeAsStringSync('# Generated by pub on 2019-11-25 12:38:01.801784.');
|
||||
final Directory libDir = tempDir.childDirectory('lib');
|
||||
libDir.createSync();
|
||||
final File mainFile = libDir.childFile('main.dart');
|
||||
|
@ -1414,7 +1414,7 @@ plugin1=${plugin1.path}
|
||||
.childDirectory('apk')
|
||||
.childDirectory('release')
|
||||
.childFile('app-release.apk')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
await buildGradleApp(
|
||||
project: FlutterProject.current(),
|
||||
@ -1580,7 +1580,7 @@ plugin1=${plugin1.path}
|
||||
.childDirectory('apk')
|
||||
.childDirectory('release')
|
||||
.childFile('app-release.apk')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
await buildGradleApp(
|
||||
project: FlutterProject.current(),
|
||||
@ -2621,7 +2621,7 @@ FlutterProject generateFakeAppBundle(String directoryName, String fileName) {
|
||||
final Directory bundleDirectory = getBundleDirectory(project);
|
||||
bundleDirectory
|
||||
.childDirectory(directoryName)
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
bundleDirectory
|
||||
.childDirectory(directoryName)
|
||||
|
@ -236,8 +236,8 @@ void main() {
|
||||
|
||||
testUsingContext('returns the gradlew path', () {
|
||||
final Directory androidDirectory = globals.fs.directory('/android')..createSync();
|
||||
androidDirectory.childFile('gradlew')..createSync();
|
||||
androidDirectory.childFile('gradlew.bat')..createSync();
|
||||
androidDirectory.childFile('gradlew').createSync();
|
||||
androidDirectory.childFile('gradlew.bat').createSync();
|
||||
androidDirectory.childFile('gradle.properties').createSync();
|
||||
|
||||
when(gradleUtils.injectGradleWrapperIfNeeded(any)).thenReturn(null);
|
||||
|
@ -134,7 +134,7 @@ name: example''')
|
||||
|
||||
// touch .packages to make sure its change time is after pubspec.yaml's
|
||||
globals.fs.file('.packages')
|
||||
..setLastModifiedSync(modifiedTime);
|
||||
.setLastModifiedSync(modifiedTime);
|
||||
|
||||
// Even though the previous file was removed, it is left in the
|
||||
// asset manifest and not updated. This is due to the devfs not
|
||||
|
@ -57,7 +57,7 @@ flutter:
|
||||
- a/b/c/foo
|
||||
'''
|
||||
);
|
||||
globals.fs.file('.packages')..createSync();
|
||||
globals.fs.file('.packages').createSync();
|
||||
|
||||
final List<String> assets = <String>[
|
||||
'a/b/c/foo',
|
||||
|
@ -921,8 +921,8 @@ void main() {
|
||||
outputPreferences: OutputPreferences.test(showColor: false),
|
||||
timeoutConfiguration: const TimeoutConfiguration(),
|
||||
);
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
final List<String> output = outputStdout();
|
||||
|
||||
expect(output.length, equals(3));
|
||||
@ -947,8 +947,8 @@ void main() {
|
||||
),
|
||||
stopwatchFactory: FakeStopwatchFactory(),
|
||||
);
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
|
||||
expect(outputStdout(), <Matcher>[
|
||||
matches(r'^\[ (?: {0,2}\+[0-9]{1,4} ms| )\] AAA$'),
|
||||
@ -967,8 +967,8 @@ void main() {
|
||||
),
|
||||
outputPreferences: OutputPreferences.test(),
|
||||
);
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation)..stop();
|
||||
logger.startProgress('AAA', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
logger.startProgress('BBB', timeout: const TimeoutConfiguration().fastOperation).stop();
|
||||
|
||||
expect(logger.statusText, 'AAA\nBBB\n');
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ void main() {
|
||||
|
||||
// create pre-requisites.
|
||||
environment.buildDir.childFile('app.dill')
|
||||
..writeAsStringSync('abcd');
|
||||
.writeAsStringSync('abcd');
|
||||
final Directory hostDirectory = globals.fs.currentDirectory
|
||||
.childDirectory(getNameForHostPlatform(getCurrentHostPlatform()))
|
||||
..createSync(recursive: true);
|
||||
@ -61,7 +61,7 @@ void main() {
|
||||
|
||||
// create pre-requisites.
|
||||
environment.buildDir.childFile('app.so')
|
||||
..writeAsStringSync('abcd');
|
||||
.writeAsStringSync('abcd');
|
||||
|
||||
await const ProfileAndroidApplication().build(environment);
|
||||
|
||||
@ -80,7 +80,7 @@ void main() {
|
||||
|
||||
// create pre-requisites.
|
||||
environment.buildDir.childFile('app.so')
|
||||
..writeAsStringSync('abcd');
|
||||
.writeAsStringSync('abcd');
|
||||
|
||||
await const ReleaseAndroidApplication().build(environment);
|
||||
|
||||
|
@ -26,13 +26,13 @@ void main() {
|
||||
);
|
||||
fileSystem.file(environment.buildDir.childFile('app.dill')).createSync(recursive: true);
|
||||
fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/assets.dart')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('assets/foo/bar.png')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('assets/wildcard/#bar.png')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('.packages')
|
||||
..createSync();
|
||||
.createSync();
|
||||
fileSystem.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('''
|
||||
|
@ -111,7 +111,7 @@ void main() {
|
||||
globals.fs.file('.packages').writeAsStringSync('\n');
|
||||
// Plist file
|
||||
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
// App kernel
|
||||
environment.buildDir.childFile('app.dill').createSync(recursive: true);
|
||||
// Stub framework
|
||||
@ -140,7 +140,7 @@ void main() {
|
||||
globals.fs.file('.packages').writeAsStringSync('\n');
|
||||
// Plist file
|
||||
globals.fs.file(globals.fs.path.join('ios', 'Flutter', 'AppFrameworkInfo.plist'))
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
// Real framework
|
||||
environment.buildDir
|
||||
|
@ -137,7 +137,7 @@ void main() {
|
||||
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
||||
'isolate_snapshot.bin')).createSync(recursive: true);
|
||||
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
final String inputKernel = globals.fs.path.join(environment.buildDir.path, 'app.dill');
|
||||
final String outputKernel = globals.fs.path.join('App.framework', 'Versions', 'A', 'Resources',
|
||||
@ -160,7 +160,7 @@ void main() {
|
||||
globals.fs.file(globals.fs.path.join('bin', 'cache', 'artifacts', 'engine', 'darwin-x64',
|
||||
'isolate_snapshot.bin')).createSync(recursive: true);
|
||||
globals.fs.file(globals.fs.path.join(environment.buildDir.path, 'App.framework', 'App'))
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
final String outputKernel = globals.fs.path.join('App.framework', 'Resources',
|
||||
'flutter_assets', 'kernel_blob.bin');
|
||||
final String precompiledVm = globals.fs.path.join('App.framework', 'Resources',
|
||||
|
@ -90,9 +90,9 @@ void main() {
|
||||
environment.defines[kBuildMode] = 'release';
|
||||
final Directory webResources = environment.projectDir.childDirectory('web');
|
||||
webResources.childFile('index.html')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
webResources.childFile('foo.txt')
|
||||
..writeAsStringSync('A');
|
||||
.writeAsStringSync('A');
|
||||
environment.buildDir.childFile('main.dart.js').createSync();
|
||||
|
||||
await const WebReleaseBundle().build(environment);
|
||||
@ -315,7 +315,7 @@ void main() {
|
||||
environment.defines[kBuildMode] = 'release';
|
||||
when(globals.processManager.run(any)).thenAnswer((Invocation invocation) async {
|
||||
environment.buildDir.childFile('main.dart.js.deps')
|
||||
..writeAsStringSync('file:///a.dart');
|
||||
.writeAsStringSync('file:///a.dart');
|
||||
return FakeProcessResult(exitCode: 0);
|
||||
});
|
||||
await const Dart2JSTarget().build(environment);
|
||||
|
@ -423,7 +423,7 @@ void main() {
|
||||
final File ideviceScreenshotFile = iosUsbArtifacts.location.childFile('idevicescreenshot')
|
||||
..createSync();
|
||||
iosUsbArtifacts.location.childFile('idevicesyslog')
|
||||
..createSync();
|
||||
.createSync();
|
||||
|
||||
expect(iosUsbArtifacts.isUpToDateInner(), true);
|
||||
|
||||
|
@ -260,7 +260,7 @@ void main() {
|
||||
],
|
||||
onRun: () {
|
||||
globals.fs.file('.packages')
|
||||
..setLastModifiedSync(DateTime(2002));
|
||||
.setLastModifiedSync(DateTime(2002));
|
||||
}
|
||||
),
|
||||
const FakeCommand(
|
||||
@ -280,7 +280,7 @@ void main() {
|
||||
],
|
||||
onRun: () {
|
||||
globals.fs.file('pubspec.yaml')
|
||||
..setLastModifiedSync(DateTime(2002));
|
||||
.setLastModifiedSync(DateTime(2002));
|
||||
}
|
||||
),
|
||||
const FakeCommand(
|
||||
@ -309,9 +309,9 @@ void main() {
|
||||
testLogger.clear();
|
||||
// bad scenario 1: pub doesn't update file; doesn't matter, because we do instead
|
||||
globals.fs.file('.packages')
|
||||
..setLastModifiedSync(DateTime(2000));
|
||||
.setLastModifiedSync(DateTime(2000));
|
||||
globals.fs.file('pubspec.yaml')
|
||||
..setLastModifiedSync(DateTime(2001));
|
||||
.setLastModifiedSync(DateTime(2001));
|
||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
||||
expect(testLogger.statusText, 'Running "flutter pub get" in /...\n');
|
||||
expect(testLogger.errorText, isEmpty);
|
||||
@ -321,9 +321,9 @@ void main() {
|
||||
testLogger.clear();
|
||||
// bad scenario 2: pub changes pubspec.yaml instead
|
||||
globals.fs.file('.packages')
|
||||
..setLastModifiedSync(DateTime(2000));
|
||||
.setLastModifiedSync(DateTime(2000));
|
||||
globals.fs.file('pubspec.yaml')
|
||||
..setLastModifiedSync(DateTime(2001));
|
||||
.setLastModifiedSync(DateTime(2001));
|
||||
try {
|
||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true);
|
||||
expect(true, isFalse, reason: 'pub.get did not throw');
|
||||
@ -337,9 +337,9 @@ void main() {
|
||||
expect(globals.fs.file('.packages').lastModifiedSync(), DateTime(2000)); // because nothing touched it
|
||||
// bad scenario 3: pubspec.yaml was created in the future
|
||||
globals.fs.file('.packages')
|
||||
..setLastModifiedSync(DateTime(2000));
|
||||
.setLastModifiedSync(DateTime(2000));
|
||||
globals.fs.file('pubspec.yaml')
|
||||
..setLastModifiedSync(DateTime(9999));
|
||||
.setLastModifiedSync(DateTime(9999));
|
||||
assert(DateTime(9999).isAfter(DateTime.now()));
|
||||
await pub.get(context: PubContext.flutterTests, checkLastModified: true); // pub does nothing
|
||||
expect(testLogger.statusText, contains('Running "flutter pub get" in /...\n'));
|
||||
|
@ -575,7 +575,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
||||
..writeAsStringSync('Existing lock file.');
|
||||
await Future<void>.delayed(const Duration(milliseconds: 10));
|
||||
projectUnderTest.ios.podfile
|
||||
..writeAsStringSync('Updated Podfile');
|
||||
.writeAsStringSync('Updated Podfile');
|
||||
await cocoaPodsUnderTest.processPods(
|
||||
xcodeProject: projectUnderTest.ios,
|
||||
engineDir: 'engine/path',
|
||||
|
@ -236,7 +236,7 @@ flutter:
|
||||
.childDirectory('java')
|
||||
.childDirectory(pluginName)
|
||||
.childFile('UseOldEmbedding.java')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
flutterProject.directory
|
||||
.childFile('.packages')
|
||||
@ -855,7 +855,7 @@ EndGlobal''');
|
||||
.childDirectory('lib')
|
||||
.childDirectory('src')
|
||||
.childFile('web_plugin.dart')
|
||||
..createSync(recursive: true);
|
||||
.createSync(recursive: true);
|
||||
|
||||
flutterProject.directory
|
||||
.childFile('.packages')
|
||||
|
@ -81,7 +81,7 @@ void main() {
|
||||
urlTunneller: null,
|
||||
) as ResidentWebRunner;
|
||||
globals.fs.currentDirectory.childFile('.packages')
|
||||
..writeAsStringSync('\n');
|
||||
.writeAsStringSync('\n');
|
||||
},
|
||||
);
|
||||
});
|
||||
|
@ -632,8 +632,7 @@ class MockDeviceLogReader extends DeviceLogReader {
|
||||
}
|
||||
|
||||
void applyMocksToCommand(FlutterCommand command) {
|
||||
command
|
||||
..applicationPackages = MockApplicationPackageStore();
|
||||
command.applicationPackages = MockApplicationPackageStore();
|
||||
}
|
||||
|
||||
/// Common functionality for tracking mock interaction
|
||||
|
Loading…
x
Reference in New Issue
Block a user