Anis Alibegić 81d80c587d
Fixed a lot of typos (#141431)
Fair amount of typos spotted and fixed. Some of them are in comments, some of them are in code and some of them are in nondart files.

There is no need for issues since it's a typo fix.

I have doubts about [packages/flutter_tools/lib/src/ios/core_devices.dart](https://github.com/flutter/flutter/compare/master...anisalibegic:flutter:master#diff-fdbc1496b4bbe7e2b445a567fd385677af861c0093774e3d8cc460fdd5b794fa), I have a feeling it might broke some things on the other end, even though it's a typo.
2024-01-12 22:10:25 +00:00

57 lines
2.5 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../../foo/stopwatch_external_lib.dart' as externallib;
typedef ExternalStopwatchConstructor = externallib.MyStopwatch Function();
class StopwatchAtHome extends Stopwatch {
StopwatchAtHome();
StopwatchAtHome.create(): this();
Stopwatch get stopwatch => this;
}
void testNoStopwatches(Stopwatch stopwatch) {
stopwatch.runtimeType; // OK for now, but we probably want to catch public APIs that take a Stopwatch?
final Stopwatch localVariable = Stopwatch(); // Bad: introducing Stopwatch from dart:core.
Stopwatch().runtimeType; // Bad: introducing Stopwatch from dart:core.
(localVariable..runtimeType) // OK: not directly introducing Stopwatch.
.runtimeType;
StopwatchAtHome().runtimeType; // Bad: introducing a Stopwatch subclass.
Stopwatch anotherStopwatch = stopwatch; // OK: not directly introducing Stopwatch.
StopwatchAtHome Function() constructor = StopwatchAtHome.new; // Bad: introducing a Stopwatch constructor.
assert(() {
anotherStopwatch = constructor()..runtimeType;
constructor = StopwatchAtHome.create; // Bad: introducing a Stopwatch constructor.
anotherStopwatch = constructor()..runtimeType;
return true;
}());
anotherStopwatch.runtimeType;
externallib.MyStopwatch.create(); // Bad: introducing an external Stopwatch constructor.
ExternalStopwatchConstructor? externalConstructor;
assert(() {
externalConstructor = externallib.MyStopwatch.new; // Bad: introducing an external Stopwatch constructor.
return true;
}());
externalConstructor?.call();
externallib.stopwatch.runtimeType; // Bad: introducing an external Stopwatch.
externallib.createMyStopwatch().runtimeType; // Bad: calling an external function that returns a Stopwatch.
externallib.createStopwatch().runtimeType; // Bad: calling an external function that returns a Stopwatch.
externalConstructor = externallib.createMyStopwatch; // Bad: introducing the tear-off form of an external function that returns a Stopwatch.
constructor.call().stopwatch; // OK: existing instance.
}
void testStopwatchIgnore(Stopwatch stopwatch) {
Stopwatch().runtimeType; // flutter_ignore: stopwatch (see analyze.dart)
Stopwatch().runtimeType; // flutter_ignore: some_other_ignores, stopwatch (see analyze.dart)
}