mirror of
https://github.com/flutter/flutter
synced 2024-08-25 11:07:06 +00:00
Increase the strictness of our requiring explicit types (#7585)
...now that we have generic methods, their types need to be specified too.
This commit is contained in:
parent
99822088a7
commit
63aa1397a3
|
@ -16,7 +16,8 @@ analyzer:
|
|||
language:
|
||||
enableStrictCallChecks: true
|
||||
enableSuperMixins: true
|
||||
strong-mode: true
|
||||
strong-mode:
|
||||
implicit-dynamic: false
|
||||
errors:
|
||||
# allow overriding fields (if they use super, ideally...)
|
||||
strong_mode_invalid_field_override: ignore
|
||||
|
|
|
@ -17,7 +17,8 @@ analyzer:
|
|||
language:
|
||||
enableStrictCallChecks: true
|
||||
enableSuperMixins: true
|
||||
strong-mode: true
|
||||
strong-mode:
|
||||
implicit-dynamic: false
|
||||
errors:
|
||||
# allow overriding fields (if they use super, ideally...)
|
||||
strong_mode_invalid_field_override: ignore
|
||||
|
|
|
@ -37,7 +37,7 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
|
|||
|
||||
bool runnerFinished = false;
|
||||
|
||||
runner.exitCode.then((_) {
|
||||
runner.exitCode.whenComplete(() {
|
||||
runnerFinished = true;
|
||||
});
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ Future<Process> startProcess(String executable, List<String> arguments,
|
|||
ProcessInfo procInfo = new ProcessInfo(command, proc);
|
||||
_runningProcesses.add(procInfo);
|
||||
|
||||
proc.exitCode.then((_) {
|
||||
proc.exitCode.whenComplete(() {
|
||||
_runningProcesses.remove(procInfo);
|
||||
});
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class DialogDemoState extends State<DialogDemo> {
|
|||
context: context,
|
||||
child: child
|
||||
)
|
||||
.then((T value) { // The value passed to Navigator.pop() or null.
|
||||
.then<Null>((T value) { // The value passed to Navigator.pop() or null.
|
||||
if (value != null) {
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text('You selected: $value')
|
||||
|
@ -178,7 +178,7 @@ class DialogDemoState extends State<DialogDemo> {
|
|||
context: context,
|
||||
initialTime: _selectedTime
|
||||
)
|
||||
.then((TimeOfDay value) {
|
||||
.then<Null>((TimeOfDay value) {
|
||||
if (value != null && value != _selectedTime) {
|
||||
_selectedTime = value;
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
|
|
|
@ -48,7 +48,7 @@ class DateTimeItem extends StatelessWidget {
|
|||
firstDate: date.subtract(const Duration(days: 30)),
|
||||
lastDate: date.add(const Duration(days: 30))
|
||||
)
|
||||
.then((DateTime value) {
|
||||
.then<Null>((DateTime value) {
|
||||
onChanged(new DateTime(value.year, value.month, value.day, time.hour, time.minute));
|
||||
});
|
||||
},
|
||||
|
@ -74,7 +74,7 @@ class DateTimeItem extends StatelessWidget {
|
|||
context: context,
|
||||
initialTime: time
|
||||
)
|
||||
.then((TimeOfDay value) {
|
||||
.then<Null>((TimeOfDay value) {
|
||||
onChanged(new DateTime(date.year, date.month, date.day, value.hour, value.minute));
|
||||
});
|
||||
},
|
||||
|
@ -112,7 +112,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
|||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
showDialog(
|
||||
showDialog<DismissDialogAction>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
content: new Text(
|
||||
|
|
|
@ -22,7 +22,6 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
|||
_showBottomSheetCallback = _showBottomSheet;
|
||||
}
|
||||
|
||||
|
||||
void _showBottomSheet() {
|
||||
setState(() { // disable the button
|
||||
_showBottomSheetCallback = null;
|
||||
|
@ -45,15 +44,17 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
|||
)
|
||||
);
|
||||
})
|
||||
.closed.then((_) {
|
||||
setState(() { // re-enable the button
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
});
|
||||
.closed.whenComplete(() {
|
||||
if (mounted) {
|
||||
setState(() { // re-enable the button
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showMessage() {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
content: new Text('You tapped the floating action button.'),
|
||||
|
|
|
@ -66,7 +66,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
|
|||
}
|
||||
|
||||
void _showExplanatoryText() {
|
||||
_scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
|
||||
return new Container(
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(top: new BorderSide(color: Theme.of(context).dividerColor))
|
||||
|
|
|
@ -110,10 +110,12 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
|
|||
|
||||
@override
|
||||
void dependenciesChanged() {
|
||||
getExampleCode(config.exampleCodeTag, DefaultAssetBundle.of(context)).then((String code) {
|
||||
setState(() {
|
||||
_exampleCode = code;
|
||||
});
|
||||
getExampleCode(config.exampleCodeTag, DefaultAssetBundle.of(context)).then<Null>((String code) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_exampleCode = code;
|
||||
});
|
||||
}
|
||||
});
|
||||
super.dependenciesChanged();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestAssetBundle extends AssetBundle {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<dynamic> loadStructuredData(String key, Future<dynamic> parser(String value)) async {
|
||||
Future<dynamic> loadStructuredData<T>(String key, Future<T> parser(String value)) async {
|
||||
return parser(await loadString(key));
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void main() {
|
|||
if (!unsynchedDemoTitles.contains(demoTitle)) {
|
||||
await driver.tap(find.byTooltip('Back'));
|
||||
} else {
|
||||
await driver.runUnsynchronized(() async {
|
||||
await driver.runUnsynchronized<Future<Null>>(() async {
|
||||
await new Future<Null>.delayed(kWaitBetweenActions);
|
||||
await driver.tap(find.byTooltip('Back'));
|
||||
});
|
||||
|
|
|
@ -137,12 +137,12 @@ class CalculationManager {
|
|||
// the root bundle (see https://github.com/flutter/flutter/issues/3294).
|
||||
// However, the loading process is asynchronous, so the UI will not block
|
||||
// while the file is loaded.
|
||||
rootBundle.loadString('services/data.json').then((String data) {
|
||||
rootBundle.loadString('services/data.json').then<Null>((String data) {
|
||||
if (isRunning) {
|
||||
CalculationMessage message = new CalculationMessage(data, _receivePort.sendPort);
|
||||
final CalculationMessage message = new CalculationMessage(data, _receivePort.sendPort);
|
||||
// Spawn an isolate to JSON-parse the file contents. The JSON parsing
|
||||
// is synchronous, so if done in the main isolate, the UI would block.
|
||||
Isolate.spawn(_calculate, message).then((Isolate isolate) {
|
||||
Isolate.spawn(_calculate, message).then<Null>((Isolate isolate) {
|
||||
if (!isRunning) {
|
||||
isolate.kill(priority: Isolate.IMMEDIATE);
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef Widget TextTransformer(String name, String text);
|
||||
typedef Widget _TextTransformer(String name, String text);
|
||||
|
||||
// From https://en.wikiquote.org/wiki/2001:_A_Space_Odyssey_(film)
|
||||
const String _kDialogText = '''
|
||||
|
@ -84,7 +84,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
|||
_toText = toStyledText;
|
||||
}
|
||||
|
||||
TextTransformer _toText;
|
||||
_TextTransformer _toText;
|
||||
|
||||
void _handleTap() {
|
||||
setState(() {
|
||||
|
@ -95,7 +95,7 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Widget> lines = _kNameLines
|
||||
.map((List<String> nameAndText) => Function.apply(_toText, nameAndText))
|
||||
.map<Widget>((List<String> nameAndText) => _toText(nameAndText[0], nameAndText[1]))
|
||||
.toList();
|
||||
|
||||
List<Widget> children = <Widget>[];
|
||||
|
|
|
@ -72,7 +72,7 @@ class StockDataFetcher {
|
|||
void _fetchNextChunk() {
|
||||
if (!actuallyFetchData)
|
||||
return;
|
||||
http.get(_urlToFetch(_nextChunk++)).then((http.Response response) {
|
||||
http.get(_urlToFetch(_nextChunk++)).then<Null>((http.Response response) {
|
||||
String json = response.body;
|
||||
if (json == null) {
|
||||
print("Failed to load stock data chunk ${_nextChunk - 1}");
|
||||
|
|
|
@ -105,7 +105,7 @@ class StockHomeState extends State<StockHome> {
|
|||
});
|
||||
break;
|
||||
case _StockMenuItem.refresh:
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new _NotImplementedDialog()
|
||||
);
|
||||
|
@ -267,7 +267,7 @@ class StockHomeState extends State<StockHome> {
|
|||
Navigator.pushNamed(context, '/stock/${stock.symbol}');
|
||||
},
|
||||
onShow: (Stock stock) {
|
||||
_scaffoldKey.currentState.showBottomSheet((BuildContext context) => new StockSymbolBottomSheet(stock: stock));
|
||||
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) => new StockSymbolBottomSheet(stock: stock));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class StockSettingsState extends State<StockSettings> {
|
|||
_handleOptimismChanged(false);
|
||||
break;
|
||||
case StockMode.pessimistic:
|
||||
showDialog(
|
||||
showDialog<bool>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
title: new Text("Change mode?"),
|
||||
|
@ -85,7 +85,7 @@ class StockSettingsState extends State<StockSettings> {
|
|||
),
|
||||
]
|
||||
)
|
||||
).then(_handleOptimismChanged);
|
||||
).then<Null>(_handleOptimismChanged);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class SynchronousFuture<T> implements Future<T> {
|
|||
try {
|
||||
dynamic result = action();
|
||||
if (result is Future)
|
||||
return result.then((_) => _value);
|
||||
return result.then<T>((dynamic value) => _value);
|
||||
return this;
|
||||
} catch (e, stack) {
|
||||
return new Future<T>.error(e, stack);
|
||||
|
|
|
@ -515,7 +515,7 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> {
|
|||
elevation: config.elevation,
|
||||
theme: Theme.of(context, shadowThemeOnly: true),
|
||||
style: _textStyle,
|
||||
)).then((_DropdownRouteResult<T> newValue) {
|
||||
)).then<Null>((_DropdownRouteResult<T> newValue) {
|
||||
if (!mounted || newValue == null)
|
||||
return;
|
||||
if (config.onChanged != null)
|
||||
|
|
|
@ -535,7 +535,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
|
|||
0.0, 0.0
|
||||
)
|
||||
)
|
||||
.then((T newValue) {
|
||||
.then<Null>((T newValue) {
|
||||
if (!mounted || newValue == null)
|
||||
return;
|
||||
if (config.onSelected != null)
|
||||
|
|
|
@ -57,7 +57,7 @@ class TabController extends ChangeNotifier {
|
|||
if (duration != null) {
|
||||
_indexIsChangingCount += 1;
|
||||
_animationController
|
||||
..animateTo(_index.toDouble(), duration: duration, curve: curve).then((_) {
|
||||
..animateTo(_index.toDouble(), duration: duration, curve: curve).whenComplete(() {
|
||||
_indexIsChangingCount -= 1;
|
||||
notifyListeners();
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class AssetBundle {
|
|||
///
|
||||
/// Implementations may cache the result, so a particular key should only be
|
||||
/// used with one parser for the lifetime of the asset bundle.
|
||||
Future<dynamic> loadStructuredData(String key, Future<dynamic> parser(String value));
|
||||
Future<dynamic> loadStructuredData<T>(String key, Future<T> parser(String value));
|
||||
|
||||
/// If this is a caching asset bundle, and the given key describes a cached
|
||||
/// asset, then evict the asset from the cache so that the next time it is
|
||||
|
@ -100,7 +100,7 @@ class NetworkAssetBundle extends AssetBundle {
|
|||
/// The result is not cached. The parser is run each time the resource is
|
||||
/// fetched.
|
||||
@override
|
||||
Future<dynamic> loadStructuredData(String key, Future<dynamic> parser(String value)) async {
|
||||
Future<dynamic> loadStructuredData<T>(String key, Future<T> parser(String value)) async {
|
||||
assert(key != null);
|
||||
assert(parser != null);
|
||||
return parser(await loadString(key));
|
||||
|
@ -149,14 +149,14 @@ abstract class CachingAssetBundle extends AssetBundle {
|
|||
/// subsequent calls will be a [SynchronousFuture], which resolves its
|
||||
/// callback synchronously.
|
||||
@override
|
||||
Future<dynamic> loadStructuredData(String key, Future<dynamic> parser(String value)) {
|
||||
Future<dynamic> loadStructuredData<T>(String key, Future<T> parser(String value)) {
|
||||
assert(key != null);
|
||||
assert(parser != null);
|
||||
if (_structuredDataCache.containsKey(key))
|
||||
return _structuredDataCache[key];
|
||||
Completer<dynamic> completer;
|
||||
Future<dynamic> result;
|
||||
loadString(key, cache: false).then(parser).then((dynamic value) {
|
||||
loadString(key, cache: false).then<T>(parser).then<Null>((T value) {
|
||||
result = new SynchronousFuture<dynamic>(value);
|
||||
_structuredDataCache[key] = result;
|
||||
if (completer != null) {
|
||||
|
|
|
@ -163,7 +163,7 @@ abstract class ImageProvider<T> {
|
|||
assert(configuration != null);
|
||||
final ImageStream stream = new ImageStream();
|
||||
T obtainedKey;
|
||||
obtainKey(configuration).then((T key) {
|
||||
obtainKey(configuration).then<Null>((T key) {
|
||||
obtainedKey = key;
|
||||
stream.setCompleter(imageCache.putIfAbsent(key, () => load(key)));
|
||||
}).catchError(
|
||||
|
|
|
@ -94,7 +94,7 @@ class AssetImage extends AssetBundleImageProvider {
|
|||
final AssetBundle chosenBundle = bundle ?? configuration.bundle ?? rootBundle;
|
||||
Completer<AssetBundleImageKey> completer;
|
||||
Future<AssetBundleImageKey> result;
|
||||
chosenBundle.loadStructuredData(_kAssetManifestFileName, _manifestParser).then(
|
||||
chosenBundle.loadStructuredData<Map<String, List<String>>>(_kAssetManifestFileName, _manifestParser).then<Null>(
|
||||
(Map<String, List<String>> manifest) {
|
||||
final String chosenName = _chooseVariant(
|
||||
name,
|
||||
|
|
|
@ -239,7 +239,7 @@ class OneFrameImageStreamCompleter extends ImageStreamCompleter {
|
|||
/// FlutterErrorDetails]).
|
||||
OneFrameImageStreamCompleter(Future<ImageInfo> image, { InformationCollector informationCollector }) {
|
||||
assert(image != null);
|
||||
image.then(setImage, onError: (dynamic error, StackTrace stack) {
|
||||
image.then<Null>(setImage, onError: (dynamic error, StackTrace stack) {
|
||||
FlutterError.reportError(new FlutterErrorDetails(
|
||||
exception: error,
|
||||
stack: stack,
|
||||
|
|
|
@ -163,7 +163,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
|
|||
@override
|
||||
void didChangeLocale(Locale locale) {
|
||||
if (config.onLocaleChanged != null) {
|
||||
config.onLocaleChanged(locale).then((LocaleQueryData data) {
|
||||
config.onLocaleChanged(locale).then<Null>((LocaleQueryData data) {
|
||||
if (mounted)
|
||||
setState(() { _localeData = data; });
|
||||
});
|
||||
|
|
|
@ -423,7 +423,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
|
|||
return new MetaData(
|
||||
metaData: this,
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: config.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData(_rejectedAvatars))
|
||||
child: config.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData<dynamic>(_rejectedAvatars))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ abstract class PageableState<T extends Pageable> extends ScrollableState<T> {
|
|||
.then(_notifyPageChanged);
|
||||
}
|
||||
|
||||
void _notifyPageChanged(_) {
|
||||
void _notifyPageChanged(Null value) {
|
||||
if (config.onPageChanged != null)
|
||||
config.onPageChanged(_scrollOffsetToPageIndex(scrollOffset));
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ class AbsoluteBallisticScrollActivity extends ScrollActivity {
|
|||
)
|
||||
..addListener(_tick)
|
||||
..animateWith(simulation)
|
||||
.then(_end);
|
||||
.whenComplete(_end);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -587,7 +587,7 @@ class AbsoluteBallisticScrollActivity extends ScrollActivity {
|
|||
position.beginIdleActivity();
|
||||
}
|
||||
|
||||
void _end(Null value) {
|
||||
void _end() {
|
||||
position.beginIdleActivity();
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ class AbsoluteDrivenScrollActivity extends ScrollActivity {
|
|||
)
|
||||
..addListener(_tick)
|
||||
..animateTo(to, duration: duration, curve: curve)
|
||||
.then(_end);
|
||||
.whenComplete(_end);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -659,7 +659,7 @@ class AbsoluteDrivenScrollActivity extends ScrollActivity {
|
|||
position.beginIdleActivity();
|
||||
}
|
||||
|
||||
void _end(Null value) {
|
||||
void _end() {
|
||||
position.beginBallisticActivity(velocity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1312,7 +1312,7 @@ class ScrollableState<T extends Scrollable> extends State<T> with SingleTickerPr
|
|||
config.onScroll(_scrollOffset);
|
||||
}
|
||||
|
||||
void _handleDragDown(_) {
|
||||
void _handleDragDown(DragDownDetails details) {
|
||||
setState(() {
|
||||
_stop();
|
||||
});
|
||||
|
@ -1356,7 +1356,7 @@ class ScrollableState<T extends Scrollable> extends State<T> with SingleTickerPr
|
|||
|
||||
void _handleDragEnd(DragEndDetails details) {
|
||||
final double scrollVelocity = pixelDeltaToScrollOffset(details.velocity.pixelsPerSecond);
|
||||
fling(scrollVelocity).then((Null _) {
|
||||
fling(scrollVelocity).then<Null>((Null value) {
|
||||
_endScroll(details: details);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ void main() {
|
|||
builder: (BuildContext context) {
|
||||
return new RaisedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new CupertinoAlertDialog(
|
||||
title: new Text('The title'),
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'dart:ui' show VoidCallback;
|
|||
List<String> captureOutput(VoidCallback fn) {
|
||||
List<String> log = <String>[];
|
||||
|
||||
runZoned(fn, zoneSpecification: new ZoneSpecification(
|
||||
runZoned<Null>(fn, zoneSpecification: new ZoneSpecification(
|
||||
print: (Zone self,
|
||||
ZoneDelegate parent,
|
||||
Zone zone,
|
||||
|
|
|
@ -12,13 +12,13 @@ void main() {
|
|||
Future<int> future = new SynchronousFuture<int>(42);
|
||||
|
||||
int result;
|
||||
future.then((int value) { result = value; });
|
||||
future.then<Null>((int value) { result = value; });
|
||||
|
||||
expect(result, equals(42));
|
||||
result = null;
|
||||
|
||||
Future<int> futureWithTimeout = future.timeout(const Duration(milliseconds: 1));
|
||||
futureWithTimeout.then((int value) { result = value; });
|
||||
futureWithTimeout.then<Null>((int value) { result = value; });
|
||||
expect(result, isNull);
|
||||
await futureWithTimeout;
|
||||
expect(result, equals(42));
|
||||
|
|
|
@ -18,7 +18,7 @@ void main() {
|
|||
child: new RaisedButton(
|
||||
child: new Text('X'),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
content: new Container(
|
||||
|
@ -68,7 +68,7 @@ void main() {
|
|||
child: new RaisedButton(
|
||||
child: new Text('X'),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
title: new Text('Title'),
|
||||
|
|
|
@ -211,7 +211,7 @@ void main() {
|
|||
builder: (BuildContext context) {
|
||||
return new GestureDetector(
|
||||
onTap: () {
|
||||
Scaffold.of(context).showBottomSheet((BuildContext context) {
|
||||
Scaffold.of(context).showBottomSheet<Null>((BuildContext context) {
|
||||
return new Container(
|
||||
key: sheetKey,
|
||||
decoration: new BoxDecoration(backgroundColor: Colors.blue[500])
|
||||
|
|
|
@ -356,7 +356,7 @@ void main() {
|
|||
actionPressed = true;
|
||||
}
|
||||
),
|
||||
)).closed.then((SnackBarClosedReason reason) {
|
||||
)).closed.then<Null>((SnackBarClosedReason reason) {
|
||||
closedReason = reason;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -135,7 +135,7 @@ void main() {
|
|||
builder: (BuildContext context) {
|
||||
return new RaisedButton(
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
showModalBottomSheet<Null>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => new Text('bottomSheet'),
|
||||
);
|
||||
|
@ -172,7 +172,7 @@ void main() {
|
|||
builder: (BuildContext context) {
|
||||
return new RaisedButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new Text('dialog'),
|
||||
);
|
||||
|
@ -204,7 +204,7 @@ void main() {
|
|||
builder: (BuildContext context) {
|
||||
return new GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new Scaffold(
|
||||
body: const SizedBox(
|
||||
|
|
|
@ -65,7 +65,7 @@ void main() {
|
|||
child: new FlatButton(
|
||||
child: new Text('X'),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new SamplePage(),
|
||||
);
|
||||
|
|
|
@ -26,7 +26,7 @@ void main() {
|
|||
showModalBottomSheet<Null>(
|
||||
context: savedContext,
|
||||
builder: (BuildContext context) => new Text('BottomSheet')
|
||||
).then((Null result) {
|
||||
).then<Null>((Null result) {
|
||||
expectSync(result, isNull);
|
||||
showBottomSheetThenCalled = true;
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ void main() {
|
|||
showModalBottomSheet<Null>(
|
||||
context: savedContext,
|
||||
builder: (BuildContext context) => new Text('BottomSheet'),
|
||||
).then((Null result) {
|
||||
).then<Null>((Null result) {
|
||||
expectSync(result, isNull);
|
||||
showBottomSheetThenCalled = true;
|
||||
});
|
||||
|
@ -80,12 +80,12 @@ void main() {
|
|||
expect(showBottomSheetThenCalled, isFalse);
|
||||
expect(find.text('BottomSheet'), findsNothing);
|
||||
|
||||
scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
|
||||
return new Container(
|
||||
margin: const EdgeInsets.all(40.0),
|
||||
child: new Text('BottomSheet')
|
||||
);
|
||||
}).closed.then((_) {
|
||||
}).closed.whenComplete(() {
|
||||
showBottomSheetThenCalled = true;
|
||||
});
|
||||
|
||||
|
@ -130,7 +130,7 @@ void main() {
|
|||
)
|
||||
));
|
||||
|
||||
scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
|
||||
return new Container(
|
||||
margin: const EdgeInsets.all(40.0),
|
||||
child: new Text('BottomSheet')
|
||||
|
|
|
@ -87,8 +87,8 @@ class TestAssetImage extends AssetImage {
|
|||
@override
|
||||
Future<ImageInfo> loadAsync(AssetBundleImageKey key) {
|
||||
ImageInfo result;
|
||||
key.bundle.load(key.name).then((ByteData data) {
|
||||
decodeImage(data).then((ui.Image image) {
|
||||
key.bundle.load(key.name).then<Null>((ByteData data) {
|
||||
decodeImage(data).then<Null>((ui.Image image) {
|
||||
result = new ImageInfo(image: image, scale: key.scale);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ class PersistentBottomSheetTestState extends State<PersistentBottomSheetTest> {
|
|||
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
|
||||
return new Text('bottomSheet');
|
||||
})
|
||||
.closed.then((_) {
|
||||
.closed.whenComplete(() {
|
||||
setState(() {
|
||||
setStateCalled = true;
|
||||
});
|
||||
|
@ -421,13 +421,13 @@ void main() {
|
|||
);
|
||||
|
||||
int popCount = 0;
|
||||
route.popped.then((_) {
|
||||
++popCount;
|
||||
route.popped.whenComplete(() {
|
||||
popCount += 1;
|
||||
});
|
||||
|
||||
int completeCount = 0;
|
||||
route.completed.then((_) {
|
||||
++completeCount;
|
||||
route.completed.whenComplete(() {
|
||||
completeCount += 1;
|
||||
});
|
||||
|
||||
expect(popCount, 0);
|
||||
|
|
|
@ -19,7 +19,7 @@ class InsideState extends State<Inside> {
|
|||
);
|
||||
}
|
||||
|
||||
void _handlePointerDown(_) {
|
||||
void _handlePointerDown(PointerDownEvent event) {
|
||||
setState(() { });
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class MiddleState extends State<Middle> {
|
|||
);
|
||||
}
|
||||
|
||||
void _handlePointerDown(_) {
|
||||
void _handlePointerDown(PointerDownEvent event) {
|
||||
setState(() { });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
|||
));
|
||||
assert(_parentZone != null);
|
||||
assert(_pendingExceptionDetails != null);
|
||||
_parentZone.run(_testCompletionHandler);
|
||||
_parentZone.run<Null>(_testCompletionHandler);
|
||||
}
|
||||
);
|
||||
_parentZone = Zone.current;
|
||||
|
|
|
@ -162,7 +162,7 @@ Future<Null> main(List<String> args) async {
|
|||
else
|
||||
stderr.writeln('Oops; flutter has exited unexpectedly.');
|
||||
|
||||
_createCrashReport(args, error, chain).then((File file) {
|
||||
_createCrashReport(args, error, chain).then<Null>((File file) {
|
||||
stderr.writeln(
|
||||
'Crash report written to ${file.path};\n'
|
||||
'please let us know at https://github.com/flutter/flutter/issues.'
|
||||
|
|
|
@ -587,12 +587,11 @@ class _AdbLogReader extends DeviceLogReader {
|
|||
_timeOrigin = _adbTimestampToDateTime(lastTimestamp);
|
||||
else
|
||||
_timeOrigin = null;
|
||||
runCommand(device.adbCommandForDevice(args)).then((Process process) {
|
||||
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) {
|
||||
_process = process;
|
||||
_process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
|
||||
_process.exitCode.then((int code) {
|
||||
_process.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
|
|
@ -110,7 +110,7 @@ Future<int> runCommandAndStreamOutput(List<String> cmd, {
|
|||
|
||||
// Wait for stdout to be fully processed
|
||||
// because process.exitCode may complete first causing flaky tests.
|
||||
await subscription.asFuture();
|
||||
await subscription.asFuture<Null>();
|
||||
subscription.cancel();
|
||||
|
||||
return await process.exitCode;
|
||||
|
|
|
@ -410,13 +410,14 @@ class RecordingProcessManager implements ProcessManager {
|
|||
await files.forEach((FileSystemEntity entity) {
|
||||
File file = entity;
|
||||
Future<dynamic> readAsBytes = file.readAsBytes();
|
||||
addAllFilesToArchive.add(readAsBytes.then((List<int> data) {
|
||||
addAllFilesToArchive.add(readAsBytes.then<Null>((List<int> data) {
|
||||
archive.addFile(new ArchiveFile.noCompress(
|
||||
path.basename(file.path), data.length, data));
|
||||
path.basename(file.path), data.length, data)
|
||||
);
|
||||
}));
|
||||
});
|
||||
|
||||
await Future.wait(addAllFilesToArchive);
|
||||
await Future.wait<dynamic>(addAllFilesToArchive);
|
||||
return new ZipEncoder().encode(archive);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ class MaterialFonts {
|
|||
|
||||
return Cache._downloadFileToCache(
|
||||
Uri.parse(cache.getVersionFor(kName)), fontsDir, true
|
||||
).then((_) {
|
||||
).then<Null>((Null value) {
|
||||
cache.setStampFor(kName, cache.getVersionFor(kName));
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
|
@ -401,7 +401,7 @@ class FlutterEngine {
|
|||
|
||||
Future<Null> _downloadItem(String message, String url, Directory dest) {
|
||||
Status status = logger.startProgress(message);
|
||||
return Cache._downloadFileToCache(Uri.parse(url), dest, true).then((_) {
|
||||
return Cache._downloadFileToCache(Uri.parse(url), dest, true).then<Null>((Null value) {
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
status.cancel();
|
||||
|
|
|
@ -120,7 +120,7 @@ class AnalyzeContinuously extends AnalyzeBase {
|
|||
|
||||
if (firstAnalysis && isBenchmarking) {
|
||||
writeBenchmark(analysisTimer, issueCount, -1); // TODO(ianh): track members missing dartdocs instead of saying -1
|
||||
server.dispose().then((_) => exit(issueCount > 0 ? 1 : 0));
|
||||
server.dispose().whenComplete(() { exit(issueCount > 0 ? 1 : 0); });
|
||||
}
|
||||
|
||||
firstAnalysis = false;
|
||||
|
|
|
@ -171,7 +171,7 @@ abstract class Domain {
|
|||
if (_handlers.containsKey(command))
|
||||
return _handlers[command](args);
|
||||
throw 'command not understood: $name.$command';
|
||||
}).then((dynamic result) {
|
||||
}).then<Null>((dynamic result) {
|
||||
if (result == null) {
|
||||
_send(<String, dynamic>{'id': id});
|
||||
} else {
|
||||
|
@ -386,7 +386,7 @@ class AppDomain extends Domain {
|
|||
|
||||
if (options.debuggingEnabled) {
|
||||
connectionInfoCompleter = new Completer<DebugConnectionInfo>();
|
||||
connectionInfoCompleter.future.then((DebugConnectionInfo info) {
|
||||
connectionInfoCompleter.future.then<Null>((DebugConnectionInfo info) {
|
||||
Map<String, dynamic> params = <String, dynamic>{
|
||||
'port': info.httpUri.port,
|
||||
'wsUri': info.wsUri.toString(),
|
||||
|
@ -397,7 +397,7 @@ class AppDomain extends Domain {
|
|||
});
|
||||
}
|
||||
Completer<Null> appStartedCompleter = new Completer<Null>();
|
||||
appStartedCompleter.future.then((_) {
|
||||
appStartedCompleter.future.then<Null>((Null value) {
|
||||
_sendAppEvent(app, 'started');
|
||||
});
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ class _DevFSHttpWriter {
|
|||
Stream<List<int>> contents = content.contentsAsCompressedStream();
|
||||
await request.addStream(contents);
|
||||
HttpClientResponse response = await request.close();
|
||||
await response.drain();
|
||||
await response.drain<Null>();
|
||||
} catch (e) {
|
||||
printError('Error writing "$devicePath" to DevFS: $e');
|
||||
}
|
||||
|
@ -417,7 +417,10 @@ class DevFS {
|
|||
if (progressReporter != null) {
|
||||
final int max = _pendingOperations.length;
|
||||
int complete = 0;
|
||||
_pendingOperations.forEach((Future<dynamic> f) => f.then((dynamic v) {
|
||||
_pendingOperations.forEach((Future<dynamic> f) => f.whenComplete(() {
|
||||
// TODO(ianh): If one of the pending operations fail, we'll keep
|
||||
// calling progressReporter long after update() has completed its
|
||||
// future, assuming that doesn't crash the app.
|
||||
complete += 1;
|
||||
progressReporter(complete, max);
|
||||
}));
|
||||
|
|
|
@ -402,12 +402,11 @@ class _IOSDeviceLogReader extends DeviceLogReader {
|
|||
String get name => device.name;
|
||||
|
||||
void _start() {
|
||||
runCommand(<String>[device.loggerPath]).then((Process process) {
|
||||
runCommand(<String>[device.loggerPath]).then<Null>((Process process) {
|
||||
_process = process;
|
||||
_process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
|
||||
_process.exitCode.then((int code) {
|
||||
_process.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
|
|
@ -663,7 +663,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
|
|||
_systemProcess.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine);
|
||||
_systemProcess.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine);
|
||||
|
||||
_deviceProcess.exitCode.then((int code) {
|
||||
_deviceProcess.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@ class CoverageCollector {
|
|||
|
||||
int pid = process.pid;
|
||||
int exitCode;
|
||||
process.exitCode.then((int code) {
|
||||
process.exitCode.then<Null>((int code) {
|
||||
exitCode = code;
|
||||
});
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||
bool subprocessActive = false;
|
||||
bool controllerSinkClosed = false;
|
||||
try {
|
||||
controller.sink.done.then((_) { controllerSinkClosed = true; });
|
||||
controller.sink.done.whenComplete(() { controllerSinkClosed = true; });
|
||||
|
||||
// Prepare our WebSocket server to talk to the engine subproces.
|
||||
HttpServer server = await HttpServer.bind(_kHost, 0);
|
||||
|
@ -524,10 +524,10 @@ class _FlutterPlatformStreamSinkWrapper<S> implements StreamSink<S> {
|
|||
|
||||
@override
|
||||
Future<dynamic> close() {
|
||||
Future.wait(<Future<dynamic>>[
|
||||
Future.wait<dynamic>(<Future<dynamic>>[
|
||||
_parent.close(),
|
||||
_shellProcessClosed,
|
||||
]).then(
|
||||
]).then<Null>(
|
||||
(List<dynamic> value) {
|
||||
_done.complete();
|
||||
},
|
||||
|
|
|
@ -561,7 +561,7 @@ class VM extends ServiceObjectOwner {
|
|||
Future<Isolate> getIsolate(String isolateId) {
|
||||
if (!loaded) {
|
||||
// Trigger a VM load, then get the isolate. Ignore any errors.
|
||||
return load().then((_) => getIsolate(isolateId)).catchError((_) => null);
|
||||
return load().then<Isolate>((ServiceObject serviceObject) => getIsolate(isolateId)).catchError((dynamic error) => null);
|
||||
}
|
||||
return new Future<Isolate>.value(_isolateCache[isolateId]);
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ class _ArchiveZipBuilder extends ZipBuilder {
|
|||
final Completer<Null> finished = new Completer<Null>();
|
||||
int count = entries.length;
|
||||
entries.forEach((String archivePath, DevFSContent content) {
|
||||
content.contentsAsBytes().then((List<int> data) {
|
||||
content.contentsAsBytes().then<Null>((List<int> data) {
|
||||
archive.addFile(new ArchiveFile.noCompress(archivePath, data.length, data));
|
||||
--count;
|
||||
count -= 1;
|
||||
if (count == 0)
|
||||
finished.complete();
|
||||
});
|
||||
|
@ -73,11 +73,11 @@ class _ZipToolBuilder extends ZipBuilder {
|
|||
final Completer<Null> finished = new Completer<Null>();
|
||||
int count = entries.length;
|
||||
entries.forEach((String archivePath, DevFSContent content) {
|
||||
content.contentsAsBytes().then((List<int> data) {
|
||||
content.contentsAsBytes().then<Null>((List<int> data) {
|
||||
File file = fs.file(path.join(zipBuildDir.path, archivePath));
|
||||
file.parent.createSync(recursive: true);
|
||||
file.writeAsBytes(data).then((_) {
|
||||
--count;
|
||||
file.writeAsBytes(data).then<Null>((File value) {
|
||||
count -= 1;
|
||||
if (count == 0)
|
||||
finished.complete();
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ void main() {
|
|||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(
|
||||
<String>['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]
|
||||
).then((_) {
|
||||
).then<Null>((Null value) {
|
||||
expect(testLogger.statusText, startsWith('Analyzing 2 files...\nNo analyzer warnings!'));
|
||||
});
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void main() {
|
|||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
|
||||
return daemon.onExit.then((int code) {
|
||||
return daemon.onExit.then<Null>((int code) {
|
||||
responses.close();
|
||||
commands.close();
|
||||
expect(code, 0);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
analyzer:
|
||||
exclude:
|
||||
exclude:
|
||||
- '**'
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
analyzer:
|
||||
exclude:
|
||||
exclude:
|
||||
- '**'
|
||||
|
|
|
@ -268,7 +268,7 @@ class MockVMService extends BasicMock implements VMService {
|
|||
String fsName = request.headers.value('dev_fs_name');
|
||||
String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_path_b64')));
|
||||
messages.add('writeFile $fsName $devicePath');
|
||||
request.drain().then((_) {
|
||||
request.drain<List<int>>().then<Null>((List<int> value) {
|
||||
request.response
|
||||
..write('Got it')
|
||||
..close();
|
||||
|
|
|
@ -47,13 +47,13 @@ void main() {
|
|||
targetDeviceFinder = () {
|
||||
throw 'Unexpected call to targetDeviceFinder';
|
||||
};
|
||||
appStarter = (_) {
|
||||
appStarter = (DriveCommand command) {
|
||||
throw 'Unexpected call to appStarter';
|
||||
};
|
||||
testRunner = (_) {
|
||||
testRunner = (List<String> testArgs) {
|
||||
throw 'Unexpected call to testRunner';
|
||||
};
|
||||
appStopper = (_) {
|
||||
appStopper = (DriveCommand command) {
|
||||
throw 'Unexpected call to appStopper';
|
||||
};
|
||||
});
|
||||
|
@ -86,14 +86,14 @@ void main() {
|
|||
|
||||
testUsingContext('returns 1 when app fails to run', () async {
|
||||
withMockDevice();
|
||||
appStarter = expectAsync((_) async => 1);
|
||||
appStarter = expectAsync((DriveCommand command) async => 1);
|
||||
|
||||
String testApp = '/some/app/test_driver/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
MemoryFileSystem memFs = memoryFileSystem;
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
await memFs.file(testApp).writeAsString('main() { }');
|
||||
await memFs.file(testFile).writeAsString('main() { }');
|
||||
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
|
@ -155,14 +155,14 @@ void main() {
|
|||
String testApp = '/some/app/test/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
appStarter = expectAsync((_) {
|
||||
appStarter = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = expectAsync((List<String> testArgs) {
|
||||
expect(testArgs, <String>[testFile]);
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
appStopper = expectAsync((_) {
|
||||
appStopper = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
|
||||
|
@ -186,13 +186,13 @@ void main() {
|
|||
String testApp = '/some/app/test/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
appStarter = expectAsync((_) {
|
||||
appStarter = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = (_) {
|
||||
testRunner = (List<String> testArgs) {
|
||||
throwToolExit(null, exitCode: 123);
|
||||
};
|
||||
appStopper = expectAsync((_) {
|
||||
appStopper = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ Future<Null> main() async {
|
|||
stdout.write('> ');
|
||||
});
|
||||
|
||||
daemon.exitCode.then((int code) {
|
||||
daemon.exitCode.then<Null>((int code) {
|
||||
print('daemon exiting ($code)');
|
||||
exit(code);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue