Unverified Commit 5e1ba701 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

enable no_literal_bool_comparisons lint (#126647)

parent b45f9b36
......@@ -127,7 +127,7 @@ linter:
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
# - no_literal_bool_comparisons # needs quick fix, https://github.com/dart-lang/linter/issues/4333
- no_literal_bool_comparisons
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
......
......@@ -809,7 +809,7 @@ Future<void> _runFrameworkTests() async {
final List<String> tests = Directory(path.join(flutterRoot, 'packages', 'flutter', 'test'))
.listSync(followLinks: false)
.whereType<Directory>()
.where((Directory dir) => dir.path.endsWith('widgets') == false)
.where((Directory dir) => !dir.path.endsWith('widgets'))
.map<String>((Directory dir) => path.join('test', path.basename(dir.path)) + path.separator)
.toList();
printProgress('${green}Running packages/flutter tests$reset for $cyan${tests.join(", ")}$reset');
......
......@@ -99,7 +99,7 @@ class CodesignCommand extends Command<void> {
);
}
if (argResults!['verify'] as bool != true) {
if (!(argResults!['verify'] as bool)) {
throw ConductorException(
'Sorry, but codesigning is not implemented yet. Please pass the '
'--$kVerify flag to verify signatures.',
......
......@@ -128,7 +128,7 @@ class NextContext extends Context {
stdio.printStatus('These must be applied manually in the directory '
'${state.engine.checkoutPath} before proceeding.\n');
}
if (autoAccept == false) {
if (!autoAccept) {
final bool response = await prompt(
'Are you ready to push your engine branch to the repository '
'${state.engine.mirror.url}?',
......@@ -146,7 +146,7 @@ class NextContext extends Context {
'You must validate pre-submit CI for your engine PR, merge it, and codesign',
'binaries before proceeding.\n',
].join('\n'));
if (autoAccept == false) {
if (!autoAccept) {
// TODO(fujino): actually test if binaries have been codesigned on macOS
final bool response = await prompt(
'Has CI passed for the engine PR and binaries been codesigned?',
......@@ -236,7 +236,7 @@ class NextContext extends Context {
);
}
if (autoAccept == false) {
if (!autoAccept) {
final bool response = await prompt(
'Are you ready to push your framework branch to the repository '
'${state.framework.mirror.url}?',
......@@ -276,7 +276,7 @@ class NextContext extends Context {
previousCheckoutLocation: state.engine.checkoutPath,
);
final String engineHead = await engine.reverseParse('HEAD');
if (autoAccept == false) {
if (!autoAccept) {
final bool response = await prompt(
'Are you ready to tag commit $frameworkHead as ${state.releaseVersion}\n'
'and push to remote ${state.framework.upstream.url}?',
......@@ -302,7 +302,7 @@ class NextContext extends Context {
previousCheckoutLocation: state.framework.checkoutPath,
);
final String headRevision = await framework.reverseParse('HEAD');
if (autoAccept == false) {
if (!autoAccept) {
// dryRun: true means print out git command
await framework.pushRef(
fromRef: headRevision,
......@@ -332,7 +332,7 @@ class NextContext extends Context {
'The current status of packaging builds can be seen at:\n'
'\t$kLuciPackagingConsoleLink',
);
if (autoAccept == false) {
if (!autoAccept) {
final bool response = await prompt(
'Have all packaging builds finished successfully and post release announcements been completed?');
if (!response) {
......@@ -373,7 +373,7 @@ class NextContext extends Context {
force: force,
);
} on GitException catch (exception) {
if (exception.type == GitExceptionType.PushRejected && force == false) {
if (exception.type == GitExceptionType.PushRejected && !force) {
throw ConductorException(
'Push failed because the working branch named '
'${pbRepository.workingBranch} already exists on your mirror. '
......
......@@ -176,7 +176,7 @@ Future<void> _runABTest({
abTest.addBResult(localEngineResult);
if (silent != true && i < runsPerTest) {
if (!silent && i < runsPerTest) {
section('A/B results so far');
print(abTest.printSummary());
}
......@@ -186,7 +186,7 @@ Future<void> _runABTest({
final File jsonFile = _uniqueFile(resultsFile);
jsonFile.writeAsStringSync(const JsonEncoder.withIndent(' ').convert(abTest.jsonMap));
if (silent != true) {
if (!silent) {
section('Raw results');
print(abTest.rawResults());
}
......
......@@ -602,7 +602,7 @@ class CupertinoSliverNavigationBar extends StatefulWidget {
this.heroTag = _defaultHeroTag,
this.stretch = false,
}) : assert(
automaticallyImplyTitle == true || largeTitle != null,
automaticallyImplyTitle || largeTitle != null,
'No largeTitle has been provided but automaticallyImplyTitle is also '
'false. Either provide a largeTitle or set automaticallyImplyTitle to '
'true.',
......
......@@ -1009,7 +1009,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
isInDebugMode = true;
return true;
}());
final bool reportError = isInDebugMode || details.silent != true; // could be null
final bool reportError = isInDebugMode || !details.silent; // could be null
if (!reportError && !forceReport) {
return;
}
......
......@@ -1616,7 +1616,7 @@ abstract class DiagnosticsNode {
'showSeparator': showSeparator,
if (level != DiagnosticLevel.info)
'level': level.name,
if (showName == false)
if (!showName)
'showName': showName,
if (emptyBodyDescription != null)
'emptyBodyDescription': emptyBodyDescription,
......
......@@ -205,9 +205,9 @@ int smallestButton(int buttons) => buttons & (-buttons);
/// Example:
///
/// ```dart
/// assert(isSingleButton(0x1) == true);
/// assert(isSingleButton(0x11) == false);
/// assert(isSingleButton(0) == false);
/// assert(isSingleButton(0x1));
/// assert(!isSingleButton(0x11));
/// assert(!isSingleButton(0));
/// ```
///
/// See also:
......
......@@ -629,7 +629,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
}
if (event is PointerUpEvent) {
if (_longPressAccepted == true) {
if (_longPressAccepted) {
_checkLongPressEnd(event);
} else {
// Pointer is lifted before timeout.
......
......@@ -208,7 +208,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
// If second tap is not allowed, reset the state.
final bool isPointerAllowed = super.isPointerAllowed(event);
if (isPointerAllowed == false) {
if (!isPointerAllowed) {
_reset();
}
return isPointerAllowed;
......
......@@ -875,7 +875,7 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
setMaterialState(MaterialState.selected, widget.selected);
selectController = AnimationController(
duration: _kSelectDuration,
value: widget.selected == true ? 1.0 : 0.0,
value: widget.selected ? 1.0 : 0.0,
vsync: this,
);
selectionFade = CurvedAnimation(
......@@ -884,7 +884,7 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
);
avatarDrawerController = AnimationController(
duration: _kDrawerDuration,
value: hasAvatar || widget.selected == true ? 1.0 : 0.0,
value: hasAvatar || widget.selected ? 1.0 : 0.0,
vsync: this,
);
deleteDrawerController = AnimationController(
......@@ -1042,7 +1042,7 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
}
if (oldWidget.avatar != widget.avatar || oldWidget.selected != widget.selected) {
setState(() {
if (hasAvatar || widget.selected == true) {
if (hasAvatar || widget.selected) {
avatarDrawerController.forward();
} else {
avatarDrawerController.reverse();
......@@ -1052,7 +1052,7 @@ class _RawChipState extends State<RawChip> with MaterialStateMixin, TickerProvid
if (oldWidget.selected != widget.selected) {
setState(() {
setMaterialState(MaterialState.selected, widget.selected);
if (widget.selected == true) {
if (widget.selected) {
selectController.forward();
} else {
selectController.reverse();
......@@ -1979,7 +1979,7 @@ class _RenderChip extends RenderBox with SlottedContainerRenderObjectMixin<_Chip
_paintSelectionOverlay(context, offset);
}
if (theme.showAvatar == false && avatarDrawerAnimation.isDismissed) {
if (!theme.showAvatar && avatarDrawerAnimation.isDismissed) {
return;
}
final Color disabledColor = _disabledColor;
......
......@@ -607,7 +607,7 @@ class _SelectableTextState extends State<SelectableText> implements TextSelectio
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasDirectionality(context));
assert(
!(widget.style != null && widget.style!.inherit == false &&
!(widget.style != null && !widget.style!.inherit &&
(widget.style!.fontSize == null || widget.style!.textBaseline == null)),
'inherit false style must supply fontSize and textBaseline',
);
......
......@@ -2335,7 +2335,7 @@ class RoundSliderThumbShape extends SliderComponentShape {
@override
Size getPreferredSize(bool isEnabled, bool isDiscrete) {
return Size.fromRadius(isEnabled == true ? enabledThumbRadius : _disabledThumbRadius);
return Size.fromRadius(isEnabled ? enabledThumbRadius : _disabledThumbRadius);
}
@override
......@@ -2444,7 +2444,7 @@ class RoundRangeSliderThumbShape extends RangeSliderThumbShape {
@override
Size getPreferredSize(bool isEnabled, bool isDiscrete) {
return Size.fromRadius(isEnabled == true ? enabledThumbRadius : _disabledThumbRadius);
return Size.fromRadius(isEnabled ? enabledThumbRadius : _disabledThumbRadius);
}
@override
......
......@@ -1234,7 +1234,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
assert(debugCheckHasMaterialLocalizations(context));
assert(debugCheckHasDirectionality(context));
assert(
!(widget.style != null && widget.style!.inherit == false &&
!(widget.style != null && !widget.style!.inherit &&
(widget.style!.fontSize == null || widget.style!.textBaseline == null)),
'inherit false style must supply fontSize and textBaseline',
);
......
......@@ -185,7 +185,7 @@ bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOv
if (debugDisableShadows != debugDisableShadowsOverride ||
debugNetworkImageHttpClientProvider != null ||
debugOnPaintImage != null ||
debugInvertOversizedImages == true ||
debugInvertOversizedImages ||
debugImageOverheadAllowance != _imageOverheadAllowanceDefault) {
throw FlutterError(reason);
}
......
......@@ -60,7 +60,7 @@ class InlineSpanSemanticsInformation {
this.semanticsLabel,
this.stringAttributes = const <ui.StringAttribute>[],
this.recognizer,
}) : assert(isPlaceholder == false || (text == '\uFFFC' && semanticsLabel == null && recognizer == null)),
}) : assert(!isPlaceholder || (text == '\uFFFC' && semanticsLabel == null && recognizer == null)),
requiresOwnNode = isPlaceholder || recognizer != null;
/// The text info for a [PlaceholderSpan].
......
......@@ -151,7 +151,7 @@ class SliverMultiBoxAdaptorParentData extends SliverLogicalParentData with Conta
bool _keptAlive = false;
@override
String toString() => 'index=$index; ${keepAlive == true ? "keepAlive; " : ""}${super.toString()}';
String toString() => 'index=$index; ${keepAlive ? "keepAlive; " : ""}${super.toString()}';
}
/// A sliver with multiple box children.
......
......@@ -1158,10 +1158,10 @@ abstract class _AndroidViewControllerInternals {
'id': viewId,
'viewType': viewType,
'direction': AndroidViewController._getAndroidDirection(layoutDirection),
if (hybrid == true) 'hybrid': hybrid,
if (hybrid) 'hybrid': hybrid,
if (size != null) 'width': size.width,
if (size != null) 'height': size.height,
if (hybridFallback == true) 'hybridFallback': hybridFallback,
if (hybridFallback) 'hybridFallback': hybridFallback,
if (position != null) 'left': position.dx,
if (position != null) 'top': position.dy,
};
......
......@@ -690,7 +690,7 @@ class Actions extends StatefulWidget {
static bool _visitActionsAncestors(BuildContext context, bool Function(InheritedElement element) visitor) {
InheritedElement? actionsElement = context.getElementForInheritedWidgetOfExactType<_ActionsScope>();
while (actionsElement != null) {
if (visitor(actionsElement) == true) {
if (visitor(actionsElement)) {
break;
}
// _getParent is needed here because
......
......@@ -1499,7 +1499,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
final _ModalScopeState<T>? scope = _scopeKey.currentState;
assert(scope != null);
for (final WillPopCallback callback in List<WillPopCallback>.of(_willPopCallbacks)) {
if (await callback() != true) {
if (!await callback()) {
return RoutePopDisposition.doNotPop;
}
}
......
......@@ -64,19 +64,19 @@ class Visibility extends StatelessWidget {
this.maintainSemantics = false,
this.maintainInteractivity = false,
}) : assert(
maintainState == true || maintainAnimation == false,
maintainState || !maintainAnimation,
'Cannot maintain animations if the state is not also maintained.',
),
assert(
maintainAnimation == true || maintainSize == false,
maintainAnimation || !maintainSize,
'Cannot maintain size if animations are not maintained.',
),
assert(
maintainSize == true || maintainSemantics == false,
maintainSize || !maintainSemantics,
'Cannot maintain semantics if size is not maintained.',
),
assert(
maintainSize == true || maintainInteractivity == false,
maintainSize || !maintainInteractivity,
'Cannot maintain interactivity if size is not maintained.',
);
......@@ -354,19 +354,19 @@ class SliverVisibility extends StatelessWidget {
this.maintainSemantics = false,
this.maintainInteractivity = false,
}) : assert(
maintainState == true || maintainAnimation == false,
maintainState || !maintainAnimation,
'Cannot maintain animations if the state is not also maintained.',
),
assert(
maintainAnimation == true || maintainSize == false,
maintainAnimation || !maintainSize,
'Cannot maintain size if animations are not maintained.',
),
assert(
maintainSize == true || maintainSemantics == false,
maintainSize || !maintainSemantics,
'Cannot maintain semantics if size is not maintained.',
),
assert(
maintainSize == true || maintainInteractivity == false,
maintainSize || !maintainInteractivity,
'Cannot maintain interactivity if size is not maintained.',
);
......
......@@ -3010,7 +3010,7 @@ class _InspectorOverlayLayer extends Layer {
inDebugMode = true;
return true;
}());
if (inDebugMode == false) {
if (!inDebugMode) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary(
'The inspector should never be used in production mode due to the '
......@@ -3627,7 +3627,7 @@ class InspectorSerializationDelegate implements DiagnosticsSerializationDelegate
@override
List<DiagnosticsNode> truncateNodesList(List<DiagnosticsNode> nodes, DiagnosticsNode? owner) {
if (maxDescendantsTruncatableNode >= 0 &&
owner!.allowTruncate == true &&
owner!.allowTruncate &&
nodes.length > maxDescendantsTruncatableNode) {
nodes = service._truncateNodes(nodes, maxDescendantsTruncatableNode);
}
......
......@@ -2182,7 +2182,7 @@ class _FailingImageProvider extends ImageProvider<int> {
this.failOnLoad = false,
required this.throws,
required this.image,
}) : assert(failOnLoad == true || failOnObtainKey == true);
}) : assert(failOnLoad || failOnObtainKey);
final bool failOnObtainKey;
final bool failOnLoad;
......
......@@ -149,7 +149,7 @@ void testWidgets(
tester._testDescription = combinedDescription;
SemanticsHandle? semanticsHandle;
tester._recordNumberOfSemanticsHandles();
if (semanticsEnabled == true) {
if (semanticsEnabled) {
semanticsHandle = tester.ensureSemantics();
}
test_package.addTearDown(binding.postTest);
......@@ -420,7 +420,7 @@ Future<void> benchmarkWidgets(
assert(binding is! AutomatedTestWidgetsFlutterBinding);
final WidgetTester tester = WidgetTester._(binding);
SemanticsHandle? semanticsHandle;
if (semanticsEnabled == true) {
if (semanticsEnabled) {
semanticsHandle = tester.ensureSemantics();
}
tester._recordNumberOfSemanticsHandles();
......
......@@ -328,7 +328,7 @@ class AOTSnapshotter {
}
}
} else {
assert(stripAfterBuild == false);
assert(!stripAfterBuild);
}
return 0;
......
......@@ -1101,7 +1101,7 @@ class PrefixedErrorLogger extends DelegatingLogger {
bool? wrap,
}) {
hadErrorOutput = true;
if (message.trim().isNotEmpty == true) {
if (message.trim().isNotEmpty) {
message = 'ERROR: $message';
}
super.printError(
......
......@@ -537,7 +537,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
String? description,
bool defaultsTo = true,
}) async {
final String defaultsToStr = defaultsTo == true ? '[Y/n]' : '[y/N]';
final String defaultsToStr = defaultsTo ? '[Y/n]' : '[y/N]';
logger.printStatus('$description $defaultsToStr (empty for default)');
while (true) {
final String input = await inputs.next;
......@@ -784,7 +784,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
if (stringArg(_kJson) != null) {
return runNonInteractively();
}
if (boolArg(_kSsh) == true) {
if (boolArg(_kSsh)) {
return runInteractivelySsh();
}
throw UnsupportedError('Unknown run mode');
......
......@@ -793,7 +793,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
'--platform',
platformDill!,
],
if (unsafePackageSerialization == true) '--unsafe-package-serialization',
if (unsafePackageSerialization) '--unsafe-package-serialization',
// See: https://github.com/flutter/flutter/issues/103994
'--verbosity=error',
...?extraFrontEndOptions,
......
......@@ -706,7 +706,7 @@ class CustomDevice extends Device {
@override
Future<void> takeScreenshot(File outputFile) async {
if (supportsScreenshot == false) {
if (!supportsScreenshot) {
throw UnsupportedError('Screenshotting is not supported for this device.');
}
......@@ -874,7 +874,7 @@ class CustomDevices extends PollingDeviceDiscovery {
);
// remove all the devices we couldn't reach.
pingedDevices.removeWhere((_, bool value) => value == false);
pingedDevices.removeWhere((_, bool value) => !value);
// return only the devices.
return pingedDevices.keys.toList();
......
......@@ -149,7 +149,7 @@ abstract class DesktopDevice extends Device {
unawaited(process.exitCode.then((_) => _runningProcesses.remove(process)));
_deviceLogReader.initializeProcess(process);
if (debuggingOptions.buildInfo.isRelease == true) {
if (debuggingOptions.buildInfo.isRelease) {
return LaunchResult.succeeded();
}
final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService(_deviceLogReader,
......
......@@ -283,7 +283,7 @@ abstract class DeviceManager {
bool includeDevicesUnsupportedByProject = false,
}) {
FlutterProject? flutterProject;
if (includeDevicesUnsupportedByProject == false) {
if (!includeDevicesUnsupportedByProject) {
flutterProject = FlutterProject.current();
}
if (hasSpecifiedAllDevices) {
......@@ -312,7 +312,7 @@ abstract class DeviceManager {
Device? getSingleEphemeralDevice(List<Device> devices){
if (!hasSpecifiedDeviceId) {
try {
return devices.singleWhere((Device device) => device.ephemeral == true);
return devices.singleWhere((Device device) => device.ephemeral);
} on StateError {
return null;
}
......
......@@ -410,7 +410,7 @@ class Doctor {
}
for (final ValidationMessage message in result.messages) {
if (!message.isInformation || verbose == true) {
if (!message.isInformation || verbose) {
int hangingIndent = 2;
int indent = 4;
final String indicator = showColor ? message.coloredIndicator : message.indicator;
......
......@@ -56,8 +56,8 @@ class EmulatorManager {
emulator.id.toLowerCase() == searchText ||
emulator.name.toLowerCase() == searchText;
bool startsWithEmulatorId(Emulator emulator) =>
emulator.id.toLowerCase().startsWith(searchText) == true ||
emulator.name.toLowerCase().startsWith(searchText) == true;
emulator.id.toLowerCase().startsWith(searchText) ||
emulator.name.toLowerCase().startsWith(searchText);
Emulator? exactMatch;
for (final Emulator emulator in emulators) {
......
......@@ -607,7 +607,7 @@ class IOSDevice extends Device {
// If the debugger is not attached, killing the ios-deploy process won't stop the app.
final IOSDeployDebugger? deployDebugger = iosDeployDebugger;
if (deployDebugger != null && deployDebugger.debuggerAttached) {
return deployDebugger.exit() == true;
return deployDebugger.exit();
}
return false;
}
......
......@@ -201,9 +201,9 @@ class XcodeProjectInterpreter {
if (buildContext.environmentType == EnvironmentType.simulator)
...<String>['-sdk', 'iphonesimulator'],
'-destination',
if (buildContext.isWatch == true && buildContext.environmentType == EnvironmentType.physical)
if (buildContext.isWatch && buildContext.environmentType == EnvironmentType.physical)
'generic/platform=watchOS'
else if (buildContext.isWatch == true)
else if (buildContext.isWatch)
'generic/platform=watchOS Simulator'
else if (deviceId != null)
'id=$deviceId'
......
......@@ -48,7 +48,7 @@ class CmakeCustomCommandMigration extends ProjectMigrator {
for (final RegExpMatch match in matches) {
final String? addCustomCommandOriginal = match.group(1);
if (addCustomCommandOriginal != null && addCustomCommandOriginal.contains('VERBATIM') == false) {
if (addCustomCommandOriginal != null && !addCustomCommandOriginal.contains('VERBATIM')) {
final String addCustomCommandReplacement = '$addCustomCommandOriginal\n VERBATIM';
newProjectContents = newProjectContents.replaceAll(addCustomCommandOriginal, addCustomCommandReplacement);
}
......
......@@ -638,7 +638,7 @@ class ProxiedPortForwarder extends DevicePortForwarder {
}
Future<ServerSocket> _defaultCreateServerSocket(Logger logger, int? hostPort, bool? ipv6) async {
if (ipv6 == null || ipv6 == false) {
if (ipv6 == null || !ipv6) {
try {
return await ServerSocket.bind(InternetAddress.loopbackIPv4, hostPort ?? 0);
} on SocketException {
......
......@@ -1172,7 +1172,7 @@ abstract class FlutterCommand extends Command<void> {
}
final bool treeShakeIcons = argParser.options.containsKey('tree-shake-icons')
&& buildMode.isPrecompiled == true
&& buildMode.isPrecompiled
&& boolArg('tree-shake-icons');
final String? bundleSkSLPath = argParser.options.containsKey(FlutterOptions.kBundleSkSLPathOption)
......
......@@ -508,7 +508,7 @@ class IosProject extends XcodeBasedProject {
// In newer versions of Xcode, the build settings of the watchOS companion
// app's scheme should contain the key INFOPLIST_KEY_WKCompanionAppBundleIdentifier.
final bool watchIdentifierFound = xcodeProjectInfoFile.readAsStringSync().contains('WKCompanionAppBundleIdentifier');
if (watchIdentifierFound == false) {
if (!watchIdentifierFound) {
return false;
}
......
......@@ -103,7 +103,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) => errorCount += errors.errors.length);
await server.start();
......@@ -144,7 +144,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) {
errorCount += errors.errors.length;
});
......@@ -172,7 +172,7 @@ void main() {
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => !analyzing).first;
server.onErrors.listen((FileAnalysisErrors errors) {
errorCount += errors.errors.length;
});
......
......@@ -224,7 +224,7 @@ void main() {
FlutterProject setupProjectUnderTest(Directory currentDirectory, bool setupXcodeWorkspace) {
// This needs to be run within testWithoutContext and not setUp since FlutterProject uses context.
final FlutterProject projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
if (setupXcodeWorkspace == true) {
if (setupXcodeWorkspace) {
projectUnderTest.ios.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
projectUnderTest.macos.hostAppRoot.childDirectory('Runner.xcworkspace').createSync(recursive: true);
}
......
......@@ -39,7 +39,7 @@ class FakePub extends Fake implements Pub {
PubOutputMode outputMode = PubOutputMode.all,
}) async {
project.directory.childFile('.packages').createSync();
if (offline == true) {
if (offline) {
calledGetOffline += 1;
} else {
calledOnline += 1;
......
......@@ -1278,10 +1278,10 @@ class FakeDevice extends Fake implements Device {
bool ipv6 = false,
String? userIdentifier,
}) async {
if (startAppSuccess == false) {
if (!startAppSuccess) {
return LaunchResult.failed();
}
if (startAppSuccess == true) {
if (startAppSuccess) {
return LaunchResult.succeeded();
}
final String dartFlags = debuggingOptions.dartFlags;
......
......@@ -124,7 +124,7 @@ void verifyCommand(Command<Object?> runner) {
final String firstDescriptionLine = runner.description.split('\n').first;
expect(firstDescriptionLine, matches(_allowedTrailingPatterns), reason: "command ${runner.name}'s description does not end with the expected single period that a full sentence should end with");
if (runner.hidden == false && runner.parent == null) {
if (!runner.hidden && runner.parent == null) {
expect(
runner.category,
anyOf(
......
......@@ -163,7 +163,7 @@ void main() {
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
.where((String line) => line.isNotEmpty == true)
.where((String line) => line.isNotEmpty)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);
......@@ -194,7 +194,7 @@ void main() {
final Iterable<String> rows = testLogger.statusText
.split('\n')
.map((String line) => line.trim())
.where((String line) => line.isNotEmpty == true)
.where((String line) => line.isNotEmpty)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['beta', 'stable', 'Currently not on an official channel.']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment