Commit 15a7eb3b authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Move to real generic method syntax (#7235)

parent 2e196037
...@@ -278,12 +278,11 @@ String requireEnvVar(String name) { ...@@ -278,12 +278,11 @@ String requireEnvVar(String name) {
return value; return value;
} }
dynamic/*=T*/ requireConfigProperty/*<T>*/( T requireConfigProperty<T>(Map<String, dynamic> map, String propertyName) {
Map<String, dynamic/*<T>*/ > map, String propertyName) {
if (!map.containsKey(propertyName)) if (!map.containsKey(propertyName))
fail('Configuration property not found: $propertyName'); fail('Configuration property not found: $propertyName');
T result = map[propertyName];
return map[propertyName]; return result;
} }
String jsonEncode(dynamic data) { String jsonEncode(dynamic data) {
......
...@@ -411,7 +411,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -411,7 +411,7 @@ class CardCollectionState extends State<CardCollection> {
cardCollection = new ScrollableList( cardCollection = new ScrollableList(
snapOffsetCallback: _snapToCenter ? _toSnapOffset : null, snapOffsetCallback: _snapToCenter ? _toSnapOffset : null,
itemExtent: kFixedCardHeight, itemExtent: kFixedCardHeight,
children: _cardIndices.map/*<Widget>*/((int index) => _buildCard(context, index)) children: _cardIndices.map<Widget>((int index) => _buildCard(context, index))
); );
} else { } else {
cardCollection = new LazyBlock( cardCollection = new LazyBlock(
......
...@@ -77,15 +77,15 @@ class DesertDataSource extends DataTableSource { ...@@ -77,15 +77,15 @@ class DesertDataSource extends DataTableSource {
new Desert('Coconut slice and KitKat', 677, 41.0, 72, 8.5, 63, 12, 12), new Desert('Coconut slice and KitKat', 677, 41.0, 72, 8.5, 63, 12, 12),
]; ];
void _sort/*<T>*/(Comparable<dynamic/*=T*/> getField(Desert d), bool ascending) { void _sort<T>(Comparable<T> getField(Desert d), bool ascending) {
_deserts.sort((Desert a, Desert b) { _deserts.sort((Desert a, Desert b) {
if (!ascending) { if (!ascending) {
final Desert c = a; final Desert c = a;
a = b; a = b;
b = c; b = c;
} }
final Comparable<dynamic/*=T*/> aValue = getField(a); final Comparable<T> aValue = getField(a);
final Comparable<dynamic/*=T*/> bValue = getField(b); final Comparable<T> bValue = getField(b);
return Comparable.compare(aValue, bValue); return Comparable.compare(aValue, bValue);
}); });
notifyListeners(); notifyListeners();
...@@ -153,8 +153,8 @@ class _DataTableDemoState extends State<DataTableDemo> { ...@@ -153,8 +153,8 @@ class _DataTableDemoState extends State<DataTableDemo> {
bool _sortAscending = true; bool _sortAscending = true;
DesertDataSource _desertsDataSource = new DesertDataSource(); DesertDataSource _desertsDataSource = new DesertDataSource();
void _sort/*<T>*/(Comparable<dynamic/*=T*/> getField(Desert d), int columnIndex, bool ascending) { void _sort<T>(Comparable<T> getField(Desert d), int columnIndex, bool ascending) {
_desertsDataSource._sort/*<T>*/(getField, ascending); _desertsDataSource._sort<T>(getField, ascending);
setState(() { setState(() {
_sortColumnIndex = columnIndex; _sortColumnIndex = columnIndex;
_sortAscending = ascending; _sortAscending = ascending;
...@@ -178,44 +178,44 @@ class _DataTableDemoState extends State<DataTableDemo> { ...@@ -178,44 +178,44 @@ class _DataTableDemoState extends State<DataTableDemo> {
columns: <DataColumn>[ columns: <DataColumn>[
new DataColumn( new DataColumn(
label: new Text('Dessert (100g serving)'), label: new Text('Dessert (100g serving)'),
onSort: (int columnIndex, bool ascending) => _sort/*<String>*/((Desert d) => d.name, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<String>((Desert d) => d.name, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Calories'), label: new Text('Calories'),
tooltip: 'The total amount of food energy in the given serving size.', tooltip: 'The total amount of food energy in the given serving size.',
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.calories, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.calories, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Fat (g)'), label: new Text('Fat (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.fat, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.fat, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Carbs (g)'), label: new Text('Carbs (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.carbs, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.carbs, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Protein (g)'), label: new Text('Protein (g)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.protein, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.protein, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Sodium (mg)'), label: new Text('Sodium (mg)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.sodium, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.sodium, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Calcium (%)'), label: new Text('Calcium (%)'),
tooltip: 'The amount of calcium as a percentage of the recommended daily amount.', tooltip: 'The amount of calcium as a percentage of the recommended daily amount.',
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.calcium, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.calcium, columnIndex, ascending)
), ),
new DataColumn( new DataColumn(
label: new Text('Iron (%)'), label: new Text('Iron (%)'),
numeric: true, numeric: true,
onSort: (int columnIndex, bool ascending) => _sort/*<num>*/((Desert d) => d.iron, columnIndex, ascending) onSort: (int columnIndex, bool ascending) => _sort<num>((Desert d) => d.iron, columnIndex, ascending)
), ),
], ],
source: _desertsDataSource source: _desertsDataSource
......
...@@ -65,12 +65,12 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -65,12 +65,12 @@ class DialogDemoState extends State<DialogDemo> {
_selectedTime = new TimeOfDay(hour: now.hour, minute: now.minute); _selectedTime = new TimeOfDay(hour: now.hour, minute: now.minute);
} }
void showDemoDialog/*<T>*/({ BuildContext context, Widget child }) { void showDemoDialog<T>({ BuildContext context, Widget child }) {
showDialog/*<T>*/( showDialog<T>(
context: context, context: context,
child: child child: child
) )
.then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null. .then((T value) { // The value passed to Navigator.pop() or null.
if (value != null) { if (value != null) {
_scaffoldKey.currentState.showSnackBar(new SnackBar( _scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('You selected: $value') content: new Text('You selected: $value')
...@@ -95,7 +95,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -95,7 +95,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton( new RaisedButton(
child: new Text('ALERT'), child: new Text('ALERT'),
onPressed: () { onPressed: () {
showDemoDialog/*<DialogDemoAction>*/( showDemoDialog<DialogDemoAction>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
content: new Text( content: new Text(
...@@ -119,7 +119,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -119,7 +119,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton( new RaisedButton(
child: new Text('ALERT WITH TITLE'), child: new Text('ALERT WITH TITLE'),
onPressed: () { onPressed: () {
showDemoDialog/*<DialogDemoAction>*/( showDemoDialog<DialogDemoAction>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text('Use Google\'s location service?'), title: new Text('Use Google\'s location service?'),
...@@ -144,7 +144,7 @@ class DialogDemoState extends State<DialogDemo> { ...@@ -144,7 +144,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton( new RaisedButton(
child: new Text('SIMPLE'), child: new Text('SIMPLE'),
onPressed: () { onPressed: () {
showDemoDialog/*<String>*/( showDemoDialog<String>(
context: context, context: context,
child: new SimpleDialog( child: new SimpleDialog(
title: new Text('Set backup account'), title: new Text('Set backup account'),
......
...@@ -15,7 +15,7 @@ class ModalBottomSheetDemo extends StatelessWidget { ...@@ -15,7 +15,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
child: new RaisedButton( child: new RaisedButton(
child: new Text('SHOW BOTTOM SHEET'), child: new Text('SHOW BOTTOM SHEET'),
onPressed: () { onPressed: () {
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) { showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
return new Container( return new Container(
child: new Padding( child: new Padding(
padding: const EdgeInsets.all(32.0), padding: const EdgeInsets.all(32.0),
......
...@@ -27,7 +27,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> { ...@@ -27,7 +27,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
setState(() { // disable the button setState(() { // disable the button
_showBottomSheetCallback = null; _showBottomSheetCallback = null;
}); });
_scaffoldKey.currentState.showBottomSheet/*<Null>*/((BuildContext context) { _scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
return new Container( return new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
......
...@@ -51,7 +51,7 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -51,7 +51,7 @@ class ShrinePageState extends State<ShrinePage> {
} }
void _showShoppingCart() { void _showShoppingCart() {
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) { showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
if (config.shoppingCart.isEmpty) { if (config.shoppingCart.isEmpty) {
return new Padding( return new Padding(
padding: const EdgeInsets.all(24.0), padding: const EdgeInsets.all(24.0),
......
...@@ -80,7 +80,7 @@ class TextFieldDemoState extends State<TextFieldDemo> { ...@@ -80,7 +80,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
if (!_formWasEdited || form.validate()) if (!_formWasEdited || form.validate())
return new Future<bool>.value(true); return new Future<bool>.value(true);
return showDialog/*<bool>*/( return showDialog<bool>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
title: new Text('This form has errors'), title: new Text('This form has errors'),
......
...@@ -300,7 +300,7 @@ class StockHomeState extends State<StockHome> { ...@@ -300,7 +300,7 @@ class StockHomeState extends State<StockHome> {
} }
void _handleCreateCompany() { void _handleCreateCompany() {
showModalBottomSheet/*<Null>*/( showModalBottomSheet<Null>(
context: context, context: context,
builder: (BuildContext context) => new _CreateCompanySheet() builder: (BuildContext context) => new _CreateCompanySheet()
); );
......
...@@ -161,8 +161,8 @@ class CachingIterable<E> extends IterableBase<E> { ...@@ -161,8 +161,8 @@ class CachingIterable<E> extends IterableBase<E> {
} }
@override @override
Iterable<dynamic/*=T*/> map/*<T>*/(/*=T*/ f(E e)) { Iterable<T> map<T>(T f(E e)) {
return new CachingIterable<dynamic/*=T*/>(super.map/*<T>*/(f).iterator); return new CachingIterable<T>(super.map<T>(f).iterator);
} }
@override @override
...@@ -171,8 +171,8 @@ class CachingIterable<E> extends IterableBase<E> { ...@@ -171,8 +171,8 @@ class CachingIterable<E> extends IterableBase<E> {
} }
@override @override
Iterable<dynamic/*=T*/> expand/*<T>*/(Iterable/*<T>*/ f(E element)) { Iterable<T> expand<T>(Iterable<T> f(E element)) {
return new CachingIterable<dynamic/*=T*/>(super.expand/*<T>*/(f).iterator); return new CachingIterable<T>(super.expand<T>(f).iterator);
} }
@override @override
......
...@@ -34,11 +34,11 @@ class SynchronousFuture<T> implements Future<T> { ...@@ -34,11 +34,11 @@ class SynchronousFuture<T> implements Future<T> {
Future<T> catchError(Function onError, { bool test(dynamic error) }) => new Completer<T>().future; Future<T> catchError(Function onError, { bool test(dynamic error) }) => new Completer<T>().future;
@override @override
Future<dynamic/*=E*/> then/*<E>*/(dynamic f(T value), { Function onError }) { Future<E> then<E>(dynamic f(T value), { Function onError }) {
dynamic result = f(_value); dynamic result = f(_value);
if (result is Future<dynamic/*=E*/>) if (result is Future<E>)
return result; return result;
return new SynchronousFuture<dynamic/*=E*/>(result); return new SynchronousFuture<E>(result);
} }
@override @override
......
...@@ -275,7 +275,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -275,7 +275,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
_initialPosition = event.position; _initialPosition = event.position;
_pendingDragOffset = Offset.zero; _pendingDragOffset = Offset.zero;
if (onDown != null) if (onDown != null)
invokeCallback/*<Null>*/('onDown', () => onDown(new DragDownDetails(globalPosition: _initialPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onDown', () => onDown(new DragDownDetails(globalPosition: _initialPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
} }
...@@ -289,7 +289,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -289,7 +289,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
Offset delta = event.delta; Offset delta = event.delta;
if (_state == _DragState.accepted) { if (_state == _DragState.accepted) {
if (onUpdate != null) { if (onUpdate != null) {
invokeCallback/*<Null>*/('onUpdate', () => onUpdate(new DragUpdateDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onUpdate', () => onUpdate(new DragUpdateDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
delta: _getDeltaForDetails(delta), delta: _getDeltaForDetails(delta),
primaryDelta: _getPrimaryValueFromOffset(delta), primaryDelta: _getPrimaryValueFromOffset(delta),
globalPosition: event.position, globalPosition: event.position,
...@@ -311,12 +311,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -311,12 +311,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
Offset delta = _pendingDragOffset; Offset delta = _pendingDragOffset;
_pendingDragOffset = Offset.zero; _pendingDragOffset = Offset.zero;
if (onStart != null) { if (onStart != null) {
invokeCallback/*<Null>*/('onStart', () => onStart(new DragStartDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onStart', () => onStart(new DragStartDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
globalPosition: _initialPosition, globalPosition: _initialPosition,
))); )));
} }
if (delta != Offset.zero && onUpdate != null) { if (delta != Offset.zero && onUpdate != null) {
invokeCallback/*<Null>*/('onUpdate', () => onUpdate(new DragUpdateDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onUpdate', () => onUpdate(new DragUpdateDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
delta: _getDeltaForDetails(delta), delta: _getDeltaForDetails(delta),
primaryDelta: _getPrimaryValueFromOffset(delta), primaryDelta: _getPrimaryValueFromOffset(delta),
globalPosition: _initialPosition, globalPosition: _initialPosition,
...@@ -336,7 +336,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -336,7 +336,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
resolve(GestureDisposition.rejected); resolve(GestureDisposition.rejected);
_state = _DragState.ready; _state = _DragState.ready;
if (onCancel != null) if (onCancel != null)
invokeCallback/*<Null>*/('onCancel', onCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onCancel', onCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
return; return;
} }
bool wasAccepted = (_state == _DragState.accepted); bool wasAccepted = (_state == _DragState.accepted);
...@@ -350,12 +350,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -350,12 +350,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
final Offset pixelsPerSecond = velocity.pixelsPerSecond; final Offset pixelsPerSecond = velocity.pixelsPerSecond;
if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * kMaxFlingVelocity) if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * kMaxFlingVelocity)
velocity = new Velocity(pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) * kMaxFlingVelocity); velocity = new Velocity(pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) * kMaxFlingVelocity);
invokeCallback/*<Null>*/('onEnd', () => onEnd(new DragEndDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onEnd', () => onEnd(new DragEndDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
velocity: velocity, velocity: velocity,
primaryVelocity: _getPrimaryValueFromOffset(velocity.pixelsPerSecond), primaryVelocity: _getPrimaryValueFromOffset(velocity.pixelsPerSecond),
))); )));
} else { } else {
invokeCallback/*<Null>*/('onEnd', () => onEnd(new DragEndDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onEnd', () => onEnd(new DragEndDetails( // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
velocity: Velocity.zero, velocity: Velocity.zero,
primaryVelocity: 0.0, primaryVelocity: 0.0,
))); )));
......
...@@ -26,7 +26,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -26,7 +26,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
void didExceedDeadline() { void didExceedDeadline() {
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
if (onLongPress != null) if (onLongPress != null)
invokeCallback/*<Null>*/('onLongPress', onLongPress); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onLongPress', onLongPress); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
@override @override
......
...@@ -261,7 +261,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten ...@@ -261,7 +261,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
assert(state._pendingDelta != null); assert(state._pendingDelta != null);
Drag drag; Drag drag;
if (onStart != null) if (onStart != null)
drag = invokeCallback/*<Drag>*/('onStart', () => onStart(initialPosition)); drag = invokeCallback<Drag>('onStart', () => onStart(initialPosition));
if (drag != null) { if (drag != null) {
state._startDrag(drag); state._startDrag(drag);
} else { } else {
......
...@@ -191,7 +191,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer { ...@@ -191,7 +191,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
_freezeTracker(tracker); _freezeTracker(tracker);
_trackers.remove(tracker.pointer); _trackers.remove(tracker.pointer);
if (onDoubleTap != null) if (onDoubleTap != null)
invokeCallback/*<Null>*/('onDoubleTap', onDoubleTap); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onDoubleTap', onDoubleTap); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
_reset(); _reset();
} }
...@@ -352,7 +352,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -352,7 +352,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
longTapDelay: longTapDelay longTapDelay: longTapDelay
); );
if (onTapDown != null) if (onTapDown != null)
invokeCallback/*<Null>*/('onTapDown', () => onTapDown(event.pointer, new TapDownDetails(globalPosition: event.position))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapDown', () => onTapDown(event.pointer, new TapDownDetails(globalPosition: event.position))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
@override @override
...@@ -372,22 +372,22 @@ class MultiTapGestureRecognizer extends GestureRecognizer { ...@@ -372,22 +372,22 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
assert(_gestureMap.containsKey(pointer)); assert(_gestureMap.containsKey(pointer));
_gestureMap.remove(pointer); _gestureMap.remove(pointer);
if (onTapCancel != null) if (onTapCancel != null)
invokeCallback/*<Null>*/('onTapCancel', () => onTapCancel(pointer)); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapCancel', () => onTapCancel(pointer)); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
void _dispatchTap(int pointer, Point globalPosition) { void _dispatchTap(int pointer, Point globalPosition) {
assert(_gestureMap.containsKey(pointer)); assert(_gestureMap.containsKey(pointer));
_gestureMap.remove(pointer); _gestureMap.remove(pointer);
if (onTapUp != null) if (onTapUp != null)
invokeCallback/*<Null>*/('onTapUp', () => onTapUp(pointer, new TapUpDetails(globalPosition: globalPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapUp', () => onTapUp(pointer, new TapUpDetails(globalPosition: globalPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
if (onTap != null) if (onTap != null)
invokeCallback/*<Null>*/('onTap', () => onTap(pointer)); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTap', () => onTap(pointer)); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
void _dispatchLongTap(int pointer, Point lastPosition) { void _dispatchLongTap(int pointer, Point lastPosition) {
assert(_gestureMap.containsKey(pointer)); assert(_gestureMap.containsKey(pointer));
if (onLongTapDown != null) if (onLongTapDown != null)
invokeCallback/*<Null>*/('onLongTapDown', () => onLongTapDown(pointer, new TapDownDetails(globalPosition: lastPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onLongTapDown', () => onLongTapDown(pointer, new TapDownDetails(globalPosition: lastPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
@override @override
......
...@@ -59,8 +59,8 @@ abstract class GestureRecognizer extends GestureArenaMember { ...@@ -59,8 +59,8 @@ abstract class GestureRecognizer extends GestureArenaMember {
/// Invoke a callback provided by the application, catching and logging any /// Invoke a callback provided by the application, catching and logging any
/// exceptions. /// exceptions.
@protected @protected
dynamic/*=T*/ invokeCallback/*<T>*/(String name, RecognizerCallback<dynamic/*=T*/> callback) { T invokeCallback<T>(String name, RecognizerCallback<T> callback) {
dynamic/*=T*/ result; T result;
try { try {
result = callback(); result = callback();
} catch (exception, stack) { } catch (exception, stack) {
......
...@@ -180,9 +180,9 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -180,9 +180,9 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
final Offset pixelsPerSecond = velocity.pixelsPerSecond; final Offset pixelsPerSecond = velocity.pixelsPerSecond;
if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * kMaxFlingVelocity) if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * kMaxFlingVelocity)
velocity = new Velocity(pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) * kMaxFlingVelocity); velocity = new Velocity(pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) * kMaxFlingVelocity);
invokeCallback/*<Null>*/('onEnd', () => onEnd(new ScaleEndDetails(velocity: velocity))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onEnd', () => onEnd(new ScaleEndDetails(velocity: velocity))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} else { } else {
invokeCallback/*<Null>*/('onEnd', () => onEnd(new ScaleEndDetails(velocity: Velocity.zero))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onEnd', () => onEnd(new ScaleEndDetails(velocity: Velocity.zero))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
} }
_state = ScaleState.accepted; _state = ScaleState.accepted;
...@@ -200,11 +200,11 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -200,11 +200,11 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
if (_state == ScaleState.accepted && !configChanged) { if (_state == ScaleState.accepted && !configChanged) {
_state = ScaleState.started; _state = ScaleState.started;
if (onStart != null) if (onStart != null)
invokeCallback/*<Null>*/('onStart', () => onStart(new ScaleStartDetails(focalPoint: focalPoint))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onStart', () => onStart(new ScaleStartDetails(focalPoint: focalPoint))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
if (_state == ScaleState.started && onUpdate != null) if (_state == ScaleState.started && onUpdate != null)
invokeCallback/*<Null>*/('onUpdate', () => onUpdate(new ScaleUpdateDetails(scale: _scaleFactor, focalPoint: focalPoint))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onUpdate', () => onUpdate(new ScaleUpdateDetails(scale: _scaleFactor, focalPoint: focalPoint))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
} }
@override @override
......
...@@ -99,7 +99,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -99,7 +99,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
void resolve(GestureDisposition disposition) { void resolve(GestureDisposition disposition) {
if (_wonArenaForPrimaryPointer && disposition == GestureDisposition.rejected) { if (_wonArenaForPrimaryPointer && disposition == GestureDisposition.rejected) {
if (onTapCancel != null) if (onTapCancel != null)
invokeCallback/*<Null>*/('onTapCancel', onTapCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapCancel', onTapCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
_reset(); _reset();
} }
super.resolve(disposition); super.resolve(disposition);
...@@ -126,7 +126,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -126,7 +126,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
if (pointer == primaryPointer) { if (pointer == primaryPointer) {
assert(state == GestureRecognizerState.defunct); assert(state == GestureRecognizerState.defunct);
if (onTapCancel != null) if (onTapCancel != null)
invokeCallback/*<Null>*/('onTapCancel', onTapCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapCancel', onTapCancel); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
_reset(); _reset();
} }
} }
...@@ -134,7 +134,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -134,7 +134,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
void _checkDown() { void _checkDown() {
if (!_sentTapDown) { if (!_sentTapDown) {
if (onTapDown != null) if (onTapDown != null)
invokeCallback/*<Null>*/('onTapDown', () => onTapDown(new TapDownDetails(globalPosition: initialPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapDown', () => onTapDown(new TapDownDetails(globalPosition: initialPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
_sentTapDown = true; _sentTapDown = true;
} }
} }
...@@ -143,9 +143,9 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer { ...@@ -143,9 +143,9 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
if (_wonArenaForPrimaryPointer && _finalPosition != null) { if (_wonArenaForPrimaryPointer && _finalPosition != null) {
resolve(GestureDisposition.accepted); resolve(GestureDisposition.accepted);
if (onTapUp != null) if (onTapUp != null)
invokeCallback/*<Null>*/('onTapUp', () => onTapUp(new TapUpDetails(globalPosition: _finalPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTapUp', () => onTapUp(new TapUpDetails(globalPosition: _finalPosition))); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
if (onTap != null) if (onTap != null)
invokeCallback/*<Null>*/('onTap', onTap); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504 invokeCallback<Null>('onTap', onTap); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27504
_reset(); _reset();
} }
} }
......
...@@ -161,7 +161,7 @@ Future<String> read(dynamic url, {Map<String, String> headers}) => ...@@ -161,7 +161,7 @@ Future<String> read(dynamic url, {Map<String, String> headers}) =>
Future<Uint8List> readBytes(dynamic url, {Map<String, String> headers}) => Future<Uint8List> readBytes(dynamic url, {Map<String, String> headers}) =>
_withClient((Client client) => client.readBytes(url, headers: headers)); _withClient((Client client) => client.readBytes(url, headers: headers));
Future/*<T>*/ _withClient/*<T>*/(Future/*<T>*/ fn(Client client)) async { Future<T> _withClient<T>(Future<T> fn(Client client)) async {
Client client = new Client(); Client client = new Client();
try { try {
return await fn(client); return await fn(client);
......
...@@ -62,7 +62,7 @@ class IOClient extends BaseClient { ...@@ -62,7 +62,7 @@ class IOClient extends BaseClient {
}); });
return new StreamedResponse( return new StreamedResponse(
DelegatingStream.typed/*<List<int>>*/(response).handleError((dynamic error) => DelegatingStream.typed<List<int>>(response).handleError((dynamic error) =>
throw new ClientException(error.message, error.uri), throw new ClientException(error.message, error.uri),
test: (dynamic error) => io.isHttpException(error)), test: (dynamic error) => io.isHttpException(error)),
response.statusCode, response.statusCode,
......
...@@ -85,7 +85,7 @@ ByteStream toByteStream(Stream<List<int>> stream) { ...@@ -85,7 +85,7 @@ ByteStream toByteStream(Stream<List<int>> stream) {
/// Calls [onDone] once [stream] (a single-subscription [Stream]) is finished. /// Calls [onDone] once [stream] (a single-subscription [Stream]) is finished.
/// The return value, also a single-subscription [Stream] should be used in /// The return value, also a single-subscription [Stream] should be used in
/// place of [stream] after calling this method. /// place of [stream] after calling this method.
Stream/*<T>*/ onDone/*<T>*/(Stream/*<T>*/ stream, void onDone()) => Stream<T> onDone<T>(Stream<T> stream, void onDone()) =>
stream.transform(new StreamTransformer.fromHandlers(handleDone: (EventSink<dynamic> sink) { // ignore: always_specify_types stream.transform(new StreamTransformer.fromHandlers(handleDone: (EventSink<dynamic> sink) { // ignore: always_specify_types
sink.close(); sink.close();
onDone(); onDone();
......
...@@ -147,7 +147,7 @@ void showAboutDialog({ ...@@ -147,7 +147,7 @@ void showAboutDialog({
String applicationLegalese, String applicationLegalese,
List<Widget> children List<Widget> children
}) { }) {
showDialog/*<Null>*/( showDialog<Null>(
context: context, context: context,
child: new AboutDialog( child: new AboutDialog(
applicationName: applicationName, applicationName: applicationName,
......
...@@ -163,10 +163,10 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[ ...@@ -163,10 +163,10 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[
typedef dynamic _KeyFunc<T>(T input); typedef dynamic _KeyFunc<T>(T input);
// Select the element for which the key function returns the maximum value. // Select the element for which the key function returns the maximum value.
dynamic/*=T*/ _maxBy/*<T>*/(Iterable<dynamic/*=T*/> input, _KeyFunc/*<T>*/ keyFunc) { T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) {
dynamic/*=T*/ maxValue; T maxValue;
dynamic maxKey; dynamic maxKey;
for (dynamic/*=T*/ value in input) { for (T value in input) {
dynamic key = keyFunc(value); dynamic key = keyFunc(value);
if (maxKey == null || key > maxKey) { if (maxKey == null || key > maxKey) {
maxValue = value; maxValue = value;
...@@ -200,7 +200,7 @@ class MaterialRectArcTween extends RectTween { ...@@ -200,7 +200,7 @@ class MaterialRectArcTween extends RectTween {
assert(begin != null); assert(begin != null);
assert(end != null); assert(end != null);
final Offset centersVector = end.center - begin.center; final Offset centersVector = end.center - begin.center;
_diagonal = _maxBy/*<_Diagonal>*/(_allDiagonals, (_Diagonal d) => _diagonalSupport(centersVector, d)); _diagonal = _maxBy<_Diagonal>(_allDiagonals, (_Diagonal d) => _diagonalSupport(centersVector, d));
_beginArc = new MaterialPointArcTween( _beginArc = new MaterialPointArcTween(
begin: _cornerFor(begin, _diagonal.beginId), begin: _cornerFor(begin, _diagonal.beginId),
end: _cornerFor(end, _diagonal.beginId) end: _cornerFor(end, _diagonal.beginId)
......
...@@ -256,10 +256,10 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> { ...@@ -256,10 +256,10 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
/// * [BottomSheet] /// * [BottomSheet]
/// * [Scaffold.showBottomSheet] /// * [Scaffold.showBottomSheet]
/// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-modal-bottom-sheets> /// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-modal-bottom-sheets>
Future<dynamic/*=T*/> showModalBottomSheet/*<T>*/({ BuildContext context, WidgetBuilder builder }) { Future<T> showModalBottomSheet<T>({ BuildContext context, WidgetBuilder builder }) {
assert(context != null); assert(context != null);
assert(builder != null); assert(builder != null);
return Navigator.push(context, new _ModalBottomSheetRoute<dynamic/*=T*/>( return Navigator.push(context, new _ModalBottomSheetRoute<T>(
builder: builder, builder: builder,
theme: Theme.of(context, shadowThemeOnly: true), theme: Theme.of(context, shadowThemeOnly: true),
)); ));
......
...@@ -57,7 +57,7 @@ class ButtonBar extends StatelessWidget { ...@@ -57,7 +57,7 @@ class ButtonBar extends StatelessWidget {
child: new Row( child: new Row(
mainAxisAlignment: alignment, mainAxisAlignment: alignment,
mainAxisSize: mainAxisSize, mainAxisSize: mainAxisSize,
children: children.map/*<Widget>*/((Widget child) { children: children.map<Widget>((Widget child) {
return new Padding( return new Padding(
padding: new EdgeInsets.symmetric(horizontal: paddingUnit), padding: new EdgeInsets.symmetric(horizontal: paddingUnit),
child: child child: child
......
...@@ -361,11 +361,11 @@ class _DialogRoute<T> extends PopupRoute<T> { ...@@ -361,11 +361,11 @@ class _DialogRoute<T> extends PopupRoute<T> {
/// * [AlertDialog], for dialogs that have a row of buttons below the body. /// * [AlertDialog], for dialogs that have a row of buttons below the body.
/// * [Dialog], on which [SimpleDialog] and [AlertDialog] are based. /// * [Dialog], on which [SimpleDialog] and [AlertDialog] are based.
/// * <https://material.google.com/components/dialogs.html> /// * <https://material.google.com/components/dialogs.html>
Future<dynamic/*=T*/> showDialog/*<T>*/({ Future<T> showDialog<T>({
@required BuildContext context, @required BuildContext context,
@required Widget child @required Widget child
}) { }) {
return Navigator.push(context, new _DialogRoute<dynamic/*=T*/>( return Navigator.push(context, new _DialogRoute<T>(
child: child, child: child,
theme: Theme.of(context, shadowThemeOnly: true), theme: Theme.of(context, shadowThemeOnly: true),
)); ));
......
...@@ -221,13 +221,13 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -221,13 +221,13 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
DataRow _getBlankRowFor(int index) { DataRow _getBlankRowFor(int index) {
return new DataRow.byIndex( return new DataRow.byIndex(
index: index, index: index,
cells: config.columns.map/*<DataCell>*/((DataColumn column) => DataCell.empty).toList() cells: config.columns.map<DataCell>((DataColumn column) => DataCell.empty).toList()
); );
} }
DataRow _getProgressIndicatorRowFor(int index) { DataRow _getProgressIndicatorRowFor(int index) {
bool haveProgressIndicator = false; bool haveProgressIndicator = false;
final List<DataCell> cells = config.columns.map/*<DataCell>*/((DataColumn column) { final List<DataCell> cells = config.columns.map<DataCell>((DataColumn column) {
if (!column.numeric) { if (!column.numeric) {
haveProgressIndicator = true; haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator()); return new DataCell(new CircularProgressIndicator());
...@@ -291,7 +291,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -291,7 +291,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
} }
if (config.actions != null) { if (config.actions != null) {
headerWidgets.addAll( headerWidgets.addAll(
config.actions.map/*<Widget>*/((Widget widget) { config.actions.map<Widget>((Widget widget) {
return new Padding( return new Padding(
// 8.0 is the default padding of an icon button // 8.0 is the default padding of an icon button
padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0), padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0),
...@@ -307,7 +307,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> { ...@@ -307,7 +307,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
if (config.onRowsPerPageChanged != null) { if (config.onRowsPerPageChanged != null) {
List<Widget> availableRowsPerPage = config.availableRowsPerPage List<Widget> availableRowsPerPage = config.availableRowsPerPage
.where((int value) => value <= _rowCount) .where((int value) => value <= _rowCount)
.map/*<DropdownMenuItem<int>>*/((int value) { .map<DropdownMenuItem<int>>((int value) {
return new DropdownMenuItem<int>( return new DropdownMenuItem<int>(
value: value, value: value,
child: new Text('$value') child: new Text('$value')
......
...@@ -437,16 +437,16 @@ class _PopupMenuRoute<T> extends PopupRoute<T> { ...@@ -437,16 +437,16 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
/// menu. The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, /// menu. The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9,
/// 12, 16, 24. The elevation defaults to 8, the appropriate elevation for popup /// 12, 16, 24. The elevation defaults to 8, the appropriate elevation for popup
/// menus. /// menus.
Future<dynamic/*=T*/> showMenu/*<T>*/({ Future<T> showMenu<T>({
BuildContext context, BuildContext context,
RelativeRect position, RelativeRect position,
List<PopupMenuEntry<dynamic/*=T*/>> items, List<PopupMenuEntry<T>> items,
dynamic/*=T*/ initialValue, T initialValue,
int elevation: 8 int elevation: 8
}) { }) {
assert(context != null); assert(context != null);
assert(items != null && items.isNotEmpty); assert(items != null && items.isNotEmpty);
return Navigator.push(context, new _PopupMenuRoute<dynamic/*=T*/>( return Navigator.push(context, new _PopupMenuRoute<T>(
position: position, position: position,
items: items, items: items,
initialValue: initialValue, initialValue: initialValue,
...@@ -525,7 +525,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -525,7 +525,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
void showButtonMenu() { void showButtonMenu() {
final RenderBox renderBox = context.findRenderObject(); final RenderBox renderBox = context.findRenderObject();
final Point topLeft = renderBox.localToGlobal(Point.origin); final Point topLeft = renderBox.localToGlobal(Point.origin);
showMenu/*<T>*/( showMenu<T>(
context: context, context: context,
elevation: config.elevation, elevation: config.elevation,
items: config.itemBuilder(context), items: config.itemBuilder(context),
......
...@@ -676,12 +676,12 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -676,12 +676,12 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
/// sheet. /// sheet.
/// * [Scaffold.of], for information about how to obtain the [ScaffoldState]. /// * [Scaffold.of], for information about how to obtain the [ScaffoldState].
/// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-persistent-bottom-sheets> /// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-persistent-bottom-sheets>
PersistentBottomSheetController<dynamic/*=T*/> showBottomSheet/*<T>*/(WidgetBuilder builder) { PersistentBottomSheetController<T> showBottomSheet<T>(WidgetBuilder builder) {
if (_currentBottomSheet != null) { if (_currentBottomSheet != null) {
_currentBottomSheet.close(); _currentBottomSheet.close();
assert(_currentBottomSheet == null); assert(_currentBottomSheet == null);
} }
Completer<dynamic/*=T*/> completer = new Completer<dynamic/*=T*/>(); Completer<T> completer = new Completer<T>();
GlobalKey<_PersistentBottomSheetState> bottomSheetKey = new GlobalKey<_PersistentBottomSheetState>(); GlobalKey<_PersistentBottomSheetState> bottomSheetKey = new GlobalKey<_PersistentBottomSheetState>();
AnimationController controller = BottomSheet.createAnimationController(this) AnimationController controller = BottomSheet.createAnimationController(this)
..forward(); ..forward();
...@@ -717,7 +717,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin { ...@@ -717,7 +717,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
); );
ModalRoute.of(context).addLocalHistoryEntry(entry); ModalRoute.of(context).addLocalHistoryEntry(entry);
setState(() { setState(() {
_currentBottomSheet = new PersistentBottomSheetController<dynamic/*=T*/>._( _currentBottomSheet = new PersistentBottomSheetController<T>._(
bottomSheet, bottomSheet,
completer, completer,
() => entry.remove(), () => entry.remove(),
......
...@@ -643,7 +643,7 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> { ...@@ -643,7 +643,7 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
size = constraints.constrain(gridSize); size = constraints.constrain(gridSize);
if (callback != null) if (callback != null)
invokeLayoutCallback/*<BoxConstraints>*/(callback); invokeLayoutCallback<BoxConstraints>(callback);
double gridTopPadding = 0.0; double gridTopPadding = 0.0;
double gridLeftPadding = 0.0; double gridLeftPadding = 0.0;
......
...@@ -153,7 +153,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -153,7 +153,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
} }
if (callback != null) if (callback != null)
invokeLayoutCallback/*<BoxConstraints>*/(callback); invokeLayoutCallback<BoxConstraints>(callback);
double itemWidth; double itemWidth;
double itemHeight; double itemHeight;
......
...@@ -1824,7 +1824,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1824,7 +1824,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
/// ///
/// This function can only be called during layout. /// This function can only be called during layout.
@protected @protected
void invokeLayoutCallback/*<T extends Constraints>*/(LayoutCallback/*<T>*/ callback) { void invokeLayoutCallback<T extends Constraints>(LayoutCallback<T> callback) {
assert(_debugMutationsLocked); assert(_debugMutationsLocked);
assert(_debugDoingThisLayout); assert(_debugDoingThisLayout);
assert(!_doingThisLayoutWithCallback); assert(!_doingThisLayoutWithCallback);
...@@ -2413,7 +2413,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -2413,7 +2413,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
debugFillDescription(description); debugFillDescription(description);
result += description result += description
.expand((String description) => debugWordWrap(description, 65, wrapIndent: ' ')) .expand((String description) => debugWordWrap(description, 65, wrapIndent: ' '))
.map/*<String>*/((String line) => "$descriptionPrefix$line\n") .map<String>((String line) => "$descriptionPrefix$line\n")
.join(); .join();
if (childrenDescription == '') if (childrenDescription == '')
result += '$prefixOtherLines\n'; result += '$prefixOtherLines\n';
......
...@@ -375,8 +375,8 @@ class DragTarget<T> extends StatefulWidget { ...@@ -375,8 +375,8 @@ class DragTarget<T> extends StatefulWidget {
_DragTargetState<T> createState() => new _DragTargetState<T>(); _DragTargetState<T> createState() => new _DragTargetState<T>();
} }
List/*<T>*/ _mapAvatarsToData/*<T>*/(List/*<_DragAvatar<T>>*/ avatars) { List<T> _mapAvatarsToData<T>(List<_DragAvatar<T>> avatars) {
return avatars.map/*<T>*/((_DragAvatar/*<T>*/ avatar) => avatar.data).toList(); return avatars.map<T>((_DragAvatar<T> avatar) => avatar.data).toList();
} }
class _DragTargetState<T> extends State<DragTarget<T>> { class _DragTargetState<T> extends State<DragTarget<T>> {
...@@ -423,7 +423,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> { ...@@ -423,7 +423,7 @@ class _DragTargetState<T> extends State<DragTarget<T>> {
return new MetaData( return new MetaData(
metaData: this, metaData: this,
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
child: config.builder(context, _mapAvatarsToData/*<T>*/(_candidateAvatars), _mapAvatarsToData(_rejectedAvatars)) child: config.builder(context, _mapAvatarsToData<T>(_candidateAvatars), _mapAvatarsToData(_rejectedAvatars))
); );
} }
} }
......
...@@ -454,7 +454,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -454,7 +454,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
if (_recognizers == null) { if (_recognizers == null) {
description.add('DISPOSED'); description.add('DISPOSED');
} else { } else {
List<String> gestures = _recognizers.values.map/*<String>*/((GestureRecognizer recognizer) => recognizer.toStringShort()).toList(); List<String> gestures = _recognizers.values.map<String>((GestureRecognizer recognizer) => recognizer.toStringShort()).toList();
if (gestures.isEmpty) if (gestures.isEmpty)
gestures.add('<none>'); gestures.add('<none>');
description.add('gestures: ${gestures.join(", ")}'); description.add('gestures: ${gestures.join(", ")}');
......
...@@ -100,7 +100,7 @@ class Table extends RenderObjectWidget { ...@@ -100,7 +100,7 @@ class Table extends RenderObjectWidget {
this.textBaseline this.textBaseline
}) : children = children, }) : children = children,
_rowDecorations = children.any((TableRow row) => row.decoration != null) _rowDecorations = children.any((TableRow row) => row.decoration != null)
? children.map/*<Decoration>*/((TableRow row) => row.decoration).toList(growable: false) ? children.map<Decoration>((TableRow row) => row.decoration).toList(growable: false)
: null, : null,
super(key: key) { super(key: key) {
assert(children != null); assert(children != null);
...@@ -246,7 +246,7 @@ class _TableElement extends RenderObjectElement { ...@@ -246,7 +246,7 @@ class _TableElement extends RenderObjectElement {
_children = widget.children.map((TableRow row) { _children = widget.children.map((TableRow row) {
return new _TableElementRow( return new _TableElementRow(
key: row.key, key: row.key,
children: row.children.map/*<Element>*/((Widget child) { children: row.children.map<Element>((Widget child) {
assert(child != null); assert(child != null);
return inflateWidget(child, null); return inflateWidget(child, null);
}).toList(growable: false) }).toList(growable: false)
......
...@@ -313,7 +313,7 @@ void main() { ...@@ -313,7 +313,7 @@ void main() {
new Scaffold(body: new Container(key: testKey)) new Scaffold(body: new Container(key: testKey))
); );
expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 600.0)); expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 600.0));
expect(tester.renderObject/*<RenderBox>*/(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0)); expect(tester.renderObject<RenderBox>(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0));
}); });
testWidgets('body size with sized container', (WidgetTester tester) async { testWidgets('body size with sized container', (WidgetTester tester) async {
...@@ -322,7 +322,7 @@ void main() { ...@@ -322,7 +322,7 @@ void main() {
new Scaffold(body: new Container(key: testKey, height: 100.0)) new Scaffold(body: new Container(key: testKey, height: 100.0))
); );
expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 100.0)); expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 100.0));
expect(tester.renderObject/*<RenderBox>*/(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0)); expect(tester.renderObject<RenderBox>(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0));
}); });
testWidgets('body size with centered container', (WidgetTester tester) async { testWidgets('body size with centered container', (WidgetTester tester) async {
...@@ -331,7 +331,7 @@ void main() { ...@@ -331,7 +331,7 @@ void main() {
new Scaffold(body: new Center(child: new Container(key: testKey))) new Scaffold(body: new Center(child: new Container(key: testKey)))
); );
expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 600.0)); expect(tester.element(find.byKey(testKey)).size, const Size(800.0, 600.0));
expect(tester.renderObject/*<RenderBox>*/(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0)); expect(tester.renderObject<RenderBox>(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0));
}); });
testWidgets('body size with button', (WidgetTester tester) async { testWidgets('body size with button', (WidgetTester tester) async {
...@@ -340,7 +340,7 @@ void main() { ...@@ -340,7 +340,7 @@ void main() {
new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: new Text(''))) new Scaffold(body: new FlatButton(key: testKey, onPressed: () { }, child: new Text('')))
); );
expect(tester.element(find.byKey(testKey)).size, const Size(88.0, 36.0)); expect(tester.element(find.byKey(testKey)).size, const Size(88.0, 36.0));
expect(tester.renderObject/*<RenderBox>*/(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0)); expect(tester.renderObject<RenderBox>(find.byKey(testKey)).localToGlobal(Point.origin), const Point(0.0, 0.0));
}); });
}); });
} }
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
testWidgets('Form.willPop callbacks do not accumulate', (WidgetTester tester) async { testWidgets('Form.willPop callbacks do not accumulate', (WidgetTester tester) async {
Future<bool> showYesNoAlert(BuildContext context) { Future<bool> showYesNoAlert(BuildContext context) {
return showDialog/*<bool>*/( return showDialog<bool>(
context: context, context: context,
child: new AlertDialog( child: new AlertDialog(
actions: <Widget> [ actions: <Widget> [
......
...@@ -18,7 +18,7 @@ void main() { ...@@ -18,7 +18,7 @@ void main() {
) )
)); ));
bottomSheet = scaffoldKey.currentState.showBottomSheet/*<Null>*/((_) { bottomSheet = scaffoldKey.currentState.showBottomSheet<Null>((_) {
return new Builder( return new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
buildCount += 1; buildCount += 1;
......
...@@ -23,7 +23,7 @@ void main() { ...@@ -23,7 +23,7 @@ void main() {
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
bool showBottomSheetThenCalled = false; bool showBottomSheetThenCalled = false;
showModalBottomSheet/*<Null>*/( showModalBottomSheet<Null>(
context: savedContext, context: savedContext,
builder: (BuildContext context) => new Text('BottomSheet') builder: (BuildContext context) => new Text('BottomSheet')
).then((Null result) { ).then((Null result) {
...@@ -45,7 +45,7 @@ void main() { ...@@ -45,7 +45,7 @@ void main() {
expect(find.text('BottomSheet'), findsNothing); expect(find.text('BottomSheet'), findsNothing);
showBottomSheetThenCalled = false; showBottomSheetThenCalled = false;
showModalBottomSheet/*<Null>*/( showModalBottomSheet<Null>(
context: savedContext, context: savedContext,
builder: (BuildContext context) => new Text('BottomSheet'), builder: (BuildContext context) => new Text('BottomSheet'),
).then((Null result) { ).then((Null result) {
......
...@@ -206,7 +206,7 @@ void main() { ...@@ -206,7 +206,7 @@ void main() {
middle = part2; middle = part2;
await tester.pumpWidget(part1); await tester.pumpWidget(part1);
for (StatefulWrapperState state in tester.stateList/*<StatefulWrapperState>*/(find.byType(StatefulWrapper))) { for (StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
expect(state.built, isNotNull); expect(state.built, isNotNull);
state.oldBuilt = state.built; state.oldBuilt = state.built;
state.trigger(); state.trigger();
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
didMiddle = false; didMiddle = false;
await tester.pumpWidget(part2); await tester.pumpWidget(part2);
for (StatefulWrapperState state in tester.stateList/*<StatefulWrapperState>*/(find.byType(StatefulWrapper))) { for (StatefulWrapperState state in tester.stateList<StatefulWrapperState>(find.byType(StatefulWrapper))) {
expect(state.built, isNotNull); expect(state.built, isNotNull);
expect(state.built, isNot(equals(state.oldBuilt))); expect(state.built, isNot(equals(state.oldBuilt)));
} }
......
...@@ -133,10 +133,10 @@ Widget buildImageAtRatio(String image, Key key, double ratio, bool inferSize) { ...@@ -133,10 +133,10 @@ Widget buildImageAtRatio(String image, Key key, double ratio, bool inferSize) {
} }
RenderImage getRenderImage(WidgetTester tester, Key key) { RenderImage getRenderImage(WidgetTester tester, Key key) {
return tester.renderObject/*<RenderImage>*/(find.byKey(key)); return tester.renderObject<RenderImage>(find.byKey(key));
} }
TestImage getTestImage(WidgetTester tester, Key key) { TestImage getTestImage(WidgetTester tester, Key key) {
return tester.renderObject/*<RenderImage>*/(find.byKey(key)).image; return tester.renderObject<RenderImage>(find.byKey(key)).image;
} }
Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) { Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {
......
...@@ -66,7 +66,7 @@ void main() { ...@@ -66,7 +66,7 @@ void main() {
}) })
)); ));
frame += 1; frame += 1;
tester.state/*<SizeChangerState>*/(find.byType(SizeChanger)).trigger(); tester.state<SizeChangerState>(find.byType(SizeChanger)).trigger();
await tester.pump(); await tester.pump();
}); });
} }
...@@ -26,7 +26,7 @@ class PersistentBottomSheetTestState extends State<PersistentBottomSheetTest> { ...@@ -26,7 +26,7 @@ class PersistentBottomSheetTestState extends State<PersistentBottomSheetTest> {
bool setStateCalled = false; bool setStateCalled = false;
void showBottomSheet() { void showBottomSheet() {
_scaffoldKey.currentState.showBottomSheet/*<Null>*/((BuildContext context) { _scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
return new Text('bottomSheet'); return new Text('bottomSheet');
}) })
.closed.then((_) { .closed.then((_) {
......
...@@ -60,7 +60,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async { ...@@ -60,7 +60,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async {
expect(find.text('100'), findsNothing); expect(find.text('100'), findsNothing);
Completer<Null> completer = new Completer<Null>(); Completer<Null> completer = new Completer<Null>();
tester.state/*<ScrollableState>*/(find.byType(Scrollable)).scrollTo(1000.0).whenComplete(completer.complete); tester.state<ScrollableState>(find.byType(Scrollable)).scrollTo(1000.0).whenComplete(completer.complete);
expect(completer.isCompleted, isFalse); expect(completer.isCompleted, isFalse);
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(completer.isCompleted, isTrue); expect(completer.isCompleted, isTrue);
......
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
expect(StatefulCreationCounterState.creationCount, 0); expect(StatefulCreationCounterState.creationCount, 0);
await tester.pumpWidget(new Bar()); await tester.pumpWidget(new Bar());
expect(StatefulCreationCounterState.creationCount, 1); expect(StatefulCreationCounterState.creationCount, 1);
BarState s = tester.state/*<BarState>*/(find.byType(Bar)); BarState s = tester.state<BarState>(find.byType(Bar));
s.trigger(); s.trigger();
await tester.pump(); await tester.pump();
expect(StatefulCreationCounterState.creationCount, 1); expect(StatefulCreationCounterState.creationCount, 1);
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
)); ));
ScrollableState scrollable = ScrollableState scrollable =
tester.state/*<ScrollableState>*/(find.byType(Scrollable)); tester.state<ScrollableState>(find.byType(Scrollable));
expect(scrollable.scrollOffset, equals(0.0)); expect(scrollable.scrollOffset, equals(0.0));
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0); await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0);
await tester.pump(); await tester.pump();
tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip(); tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
await tester.pump(const Duration(hours: 5)); await tester.pump(const Duration(hours: 5));
}); });
} }
...@@ -21,10 +21,10 @@ Future<Null> test(WidgetTester tester, double offset, { double anchor: 0.0 }) { ...@@ -21,10 +21,10 @@ Future<Null> test(WidgetTester tester, double offset, { double anchor: 0.0 }) {
} }
void verify(WidgetTester tester, List<Point> idealPositions, List<bool> idealVisibles) { void verify(WidgetTester tester, List<Point> idealPositions, List<bool> idealVisibles) {
List<Point> actualPositions = tester.renderObjectList/*<RenderBox>*/(find.byType(SizedBox)).map/*<Point>*/( List<Point> actualPositions = tester.renderObjectList<RenderBox>(find.byType(SizedBox)).map<Point>(
(RenderBox target) => target.localToGlobal(const Point(0.0, 0.0)) (RenderBox target) => target.localToGlobal(const Point(0.0, 0.0))
).toList(); ).toList();
List<bool> actualVisibles = tester.renderObjectList/*<RenderSliverToBoxAdapter>*/(find.byType(SliverToBoxAdapter)).map/*<bool>*/( List<bool> actualVisibles = tester.renderObjectList<RenderSliverToBoxAdapter>(find.byType(SliverToBoxAdapter)).map<bool>(
(RenderSliverToBoxAdapter target) => target.geometry.visible (RenderSliverToBoxAdapter target) => target.geometry.visible
).toList(); ).toList();
expect(actualPositions, equals(idealPositions)); expect(actualPositions, equals(idealPositions));
...@@ -34,7 +34,7 @@ void verify(WidgetTester tester, List<Point> idealPositions, List<bool> idealVis ...@@ -34,7 +34,7 @@ void verify(WidgetTester tester, List<Point> idealPositions, List<bool> idealVis
void main() { void main() {
testWidgets('Viewport2 basic test', (WidgetTester tester) async { testWidgets('Viewport2 basic test', (WidgetTester tester) async {
await test(tester, 0.0); await test(tester, 0.0);
expect(tester.renderObject/*<RenderBox>*/(find.byType(Viewport2)).size, equals(const Size(800.0, 600.0))); expect(tester.renderObject<RenderBox>(find.byType(Viewport2)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Point>[ verify(tester, <Point>[
const Point(0.0, 0.0), const Point(0.0, 0.0),
const Point(0.0, 400.0), const Point(0.0, 400.0),
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
testWidgets('Viewport2 anchor test', (WidgetTester tester) async { testWidgets('Viewport2 anchor test', (WidgetTester tester) async {
await test(tester, 0.0, anchor: 100.0); await test(tester, 0.0, anchor: 100.0);
expect(tester.renderObject/*<RenderBox>*/(find.byType(Viewport2)).size, equals(const Size(800.0, 600.0))); expect(tester.renderObject<RenderBox>(find.byType(Viewport2)).size, equals(const Size(800.0, 600.0)));
verify(tester, <Point>[ verify(tester, <Point>[
const Point(0.0, 100.0), const Point(0.0, 100.0),
const Point(0.0, 500.0), const Point(0.0, 500.0),
......
...@@ -89,10 +89,10 @@ class FooScrollConfiguration extends ScrollConfigurationDelegate { ...@@ -89,10 +89,10 @@ class FooScrollConfiguration extends ScrollConfigurationDelegate {
void main() { void main() {
testWidgets('https://github.com/flutter/flutter/issues/5630', (WidgetTester tester) async { testWidgets('https://github.com/flutter/flutter/issues/5630', (WidgetTester tester) async {
await tester.pumpWidget(new Foo()); await tester.pumpWidget(new Foo());
expect(tester.state/*<ScrollableState>*/(find.byType(Scrollable)).scrollOffset, 0.0); expect(tester.state<ScrollableState>(find.byType(Scrollable)).scrollOffset, 0.0);
await tester.tap(find.byType(GestureDetector).first); await tester.tap(find.byType(GestureDetector).first);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(tester.state/*<ScrollableState>*/(find.byType(Scrollable)).scrollOffset, 200.0); expect(tester.state<ScrollableState>(find.byType(Scrollable)).scrollOffset, 200.0);
}); });
} }
...@@ -54,5 +54,5 @@ class FlipWidgetState extends State<FlipWidget> { ...@@ -54,5 +54,5 @@ class FlipWidgetState extends State<FlipWidget> {
} }
void flipStatefulWidget(WidgetTester tester) { void flipStatefulWidget(WidgetTester tester) {
tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip(); tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
} }
...@@ -40,13 +40,13 @@ void main() { ...@@ -40,13 +40,13 @@ void main() {
}, },
)); ));
expect(tester.binding.transientCallbackCount, 1); expect(tester.binding.transientCallbackCount, 1);
tester.state/*<NavigatorState>*/(find.byType(Navigator)).pushNamed('/test'); tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/test');
expect(tester.binding.transientCallbackCount, 2); expect(tester.binding.transientCallbackCount, 2);
await tester.pump(); await tester.pump();
expect(tester.binding.transientCallbackCount, 2); expect(tester.binding.transientCallbackCount, 2);
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
expect(tester.binding.transientCallbackCount, 0); expect(tester.binding.transientCallbackCount, 0);
tester.state/*<NavigatorState>*/(find.byType(Navigator)).pop(); tester.state<NavigatorState>(find.byType(Navigator)).pop();
expect(tester.binding.transientCallbackCount, 1); expect(tester.binding.transientCallbackCount, 1);
await tester.pump(); await tester.pump();
expect(tester.binding.transientCallbackCount, 2); expect(tester.binding.transientCallbackCount, 2);
......
...@@ -196,7 +196,7 @@ class FlutterDriver { ...@@ -196,7 +196,7 @@ class FlutterDriver {
// option, then the VM service extension is not registered yet. Wait for // option, then the VM service extension is not registered yet. Wait for
// it to be registered. // it to be registered.
Future<dynamic> whenResumed = resumeLeniently(); Future<dynamic> whenResumed = resumeLeniently();
Future<dynamic> whenServiceExtensionReady = Future.any/*<dynamic>*/(<Future<dynamic>>[ Future<dynamic> whenServiceExtensionReady = Future.any<dynamic>(<Future<dynamic>>[
waitForServiceExtension(), waitForServiceExtension(),
// We will never receive the extension event if the user does not // We will never receive the extension event if the user does not
// register it. If that happens time out. // register it. If that happens time out.
...@@ -452,9 +452,9 @@ class FlutterDriver { ...@@ -452,9 +452,9 @@ class FlutterDriver {
/// With frame sync disabled, its the responsibility of the test author to /// With frame sync disabled, its the responsibility of the test author to
/// ensure that no action is performed while the app is undergoing a /// ensure that no action is performed while the app is undergoing a
/// transition to avoid flakiness. /// transition to avoid flakiness.
Future<dynamic/*=T*/> runUnsynchronized/*<T>*/(Future<dynamic/*=T*/> action()) async { Future<T> runUnsynchronized<T>(Future<T> action()) async {
await _sendCommand(new SetFrameSync(false)); await _sendCommand(new SetFrameSync(false));
dynamic/*=T*/ result; T result;
try { try {
result = await action(); result = await action();
} finally { } finally {
......
...@@ -160,7 +160,7 @@ class TimelineSummary { ...@@ -160,7 +160,7 @@ class TimelineSummary {
if (events.length == 0) if (events.length == 0)
return null; return null;
int total = events.fold/*<int>*/(0, (int t, TimedEvent e) => t + e.duration.inMilliseconds); int total = events.fold<int>(0, (int t, TimedEvent e) => t + e.duration.inMilliseconds);
return total / events.length; return total / events.length;
} }
...@@ -169,7 +169,7 @@ class TimelineSummary { ...@@ -169,7 +169,7 @@ class TimelineSummary {
return null; return null;
return events return events
.map/*<double>*/((TimedEvent e) => e.duration.inMilliseconds.toDouble()) .map<double>((TimedEvent e) => e.duration.inMilliseconds.toDouble())
.reduce((double a, double b) => math.max(a, b)); .reduce((double a, double b) => math.max(a, b));
} }
......
...@@ -52,7 +52,7 @@ class WidgetController { ...@@ -52,7 +52,7 @@ class WidgetController {
/// ///
/// * Use [firstWidget] if you expect to match several widgets but only want the first. /// * Use [firstWidget] if you expect to match several widgets but only want the first.
/// * Use [widgetList] if you expect to match several widgets and want all of them. /// * Use [widgetList] if you expect to match several widgets and want all of them.
Widget/*=T*/ widget/*<T extends Widget>*/(Finder finder) { T widget<T extends Widget>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().single.widget; return finder.evaluate().single.widget;
} }
...@@ -63,7 +63,7 @@ class WidgetController { ...@@ -63,7 +63,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty. /// Throws a [StateError] if `finder` is empty.
/// ///
/// * Use [widget] if you only expect to match one widget. /// * Use [widget] if you only expect to match one widget.
Widget/*=T*/ firstWidget/*<T extends Widget>*/(Finder finder) { T firstWidget<T extends Widget>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().first.widget; return finder.evaluate().first.widget;
} }
...@@ -72,11 +72,10 @@ class WidgetController { ...@@ -72,11 +72,10 @@ class WidgetController {
/// ///
/// * Use [widget] if you only expect to match one widget. /// * Use [widget] if you only expect to match one widget.
/// * Use [firstWidget] if you expect to match several but only want the first. /// * Use [firstWidget] if you expect to match several but only want the first.
Iterable<Widget/*=T*/> widgetList/*<T extends Widget>*/(Finder finder) { Iterable<T> widgetList<T extends Widget>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().map/*<T>*/((Element element) { return finder.evaluate().map<T>((Element element) {
// TODO(ianh): simplify once the VM can infer the return type T result = element.widget;
dynamic/*=T*/ result = element.widget;
return result; return result;
}); });
} }
...@@ -99,7 +98,7 @@ class WidgetController { ...@@ -99,7 +98,7 @@ class WidgetController {
/// ///
/// * Use [firstElement] if you expect to match several elements but only want the first. /// * Use [firstElement] if you expect to match several elements but only want the first.
/// * Use [elementList] if you expect to match several elements and want all of them. /// * Use [elementList] if you expect to match several elements and want all of them.
Element/*=T*/ element/*<T extends Element>*/(Finder finder) { T element<T extends Element>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().single; return finder.evaluate().single;
} }
...@@ -110,7 +109,7 @@ class WidgetController { ...@@ -110,7 +109,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty. /// Throws a [StateError] if `finder` is empty.
/// ///
/// * Use [element] if you only expect to match one element. /// * Use [element] if you only expect to match one element.
Element/*=T*/ firstElement/*<T extends Element>*/(Finder finder) { T firstElement<T extends Element>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().first; return finder.evaluate().first;
} }
...@@ -119,7 +118,7 @@ class WidgetController { ...@@ -119,7 +118,7 @@ class WidgetController {
/// ///
/// * Use [element] if you only expect to match one element. /// * Use [element] if you only expect to match one element.
/// * Use [firstElement] if you expect to match several but only want the first. /// * Use [firstElement] if you expect to match several but only want the first.
Iterable<Element/*=T*/> elementList/*<T extends Element>*/(Finder finder) { Iterable<T> elementList<T extends Element>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate(); return finder.evaluate();
} }
...@@ -144,9 +143,9 @@ class WidgetController { ...@@ -144,9 +143,9 @@ class WidgetController {
/// ///
/// * Use [firstState] if you expect to match several states but only want the first. /// * Use [firstState] if you expect to match several states but only want the first.
/// * Use [stateList] if you expect to match several states and want all of them. /// * Use [stateList] if you expect to match several states and want all of them.
State/*=T*/ state/*<T extends State>*/(Finder finder) { T state<T extends State>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return _stateOf/*<T>*/(finder.evaluate().single, finder); return _stateOf<T>(finder.evaluate().single, finder);
} }
/// The first matching state according to a depth-first pre-order /// The first matching state according to a depth-first pre-order
...@@ -156,9 +155,9 @@ class WidgetController { ...@@ -156,9 +155,9 @@ class WidgetController {
/// matching widget has no state. /// matching widget has no state.
/// ///
/// * Use [state] if you only expect to match one state. /// * Use [state] if you only expect to match one state.
State/*=T*/ firstState/*<T extends State>*/(Finder finder) { T firstState<T extends State>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return _stateOf/*<T>*/(finder.evaluate().first, finder); return _stateOf<T>(finder.evaluate().first, finder);
} }
/// The matching states in the widget tree. /// The matching states in the widget tree.
...@@ -168,12 +167,12 @@ class WidgetController { ...@@ -168,12 +167,12 @@ class WidgetController {
/// ///
/// * Use [state] if you only expect to match one state. /// * Use [state] if you only expect to match one state.
/// * Use [firstState] if you expect to match several but only want the first. /// * Use [firstState] if you expect to match several but only want the first.
Iterable<State/*=T*/> stateList/*<T extends State>*/(Finder finder) { Iterable<T> stateList<T extends State>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().map((Element element) => _stateOf/*<T>*/(element, finder)); return finder.evaluate().map((Element element) => _stateOf<T>(element, finder));
} }
State/*=T*/ _stateOf/*<T extends State>*/(Element element, Finder finder) { T _stateOf<T extends State>(Element element, Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
if (element is StatefulElement) if (element is StatefulElement)
return element.state; return element.state;
...@@ -201,7 +200,7 @@ class WidgetController { ...@@ -201,7 +200,7 @@ class WidgetController {
/// ///
/// * Use [firstRenderObject] if you expect to match several render objects but only want the first. /// * Use [firstRenderObject] if you expect to match several render objects but only want the first.
/// * Use [renderObjectList] if you expect to match several render objects and want all of them. /// * Use [renderObjectList] if you expect to match several render objects and want all of them.
RenderObject/*=T*/ renderObject/*<T extends RenderObject>*/(Finder finder) { T renderObject<T extends RenderObject>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().single.renderObject; return finder.evaluate().single.renderObject;
} }
...@@ -212,7 +211,7 @@ class WidgetController { ...@@ -212,7 +211,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty. /// Throws a [StateError] if `finder` is empty.
/// ///
/// * Use [renderObject] if you only expect to match one render object. /// * Use [renderObject] if you only expect to match one render object.
RenderObject/*=T*/ firstRenderObject/*<T extends RenderObject>*/(Finder finder) { T firstRenderObject<T extends RenderObject>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().first.renderObject; return finder.evaluate().first.renderObject;
} }
...@@ -221,11 +220,10 @@ class WidgetController { ...@@ -221,11 +220,10 @@ class WidgetController {
/// ///
/// * Use [renderObject] if you only expect to match one render object. /// * Use [renderObject] if you only expect to match one render object.
/// * Use [firstRenderObject] if you expect to match several but only want the first. /// * Use [firstRenderObject] if you expect to match several but only want the first.
Iterable<RenderObject/*=T*/> renderObjectList/*<T extends RenderObject>*/(Finder finder) { Iterable<T> renderObjectList<T extends RenderObject>(Finder finder) {
TestAsyncUtils.guardSync(); TestAsyncUtils.guardSync();
return finder.evaluate().map/*<T>*/((Element element) { return finder.evaluate().map<T>((Element element) {
// TODO(ianh): simplify once the VM can infer the return type T result = element.renderObject;
dynamic/*=T*/ result = element.renderObject;
return result; return result;
}); });
} }
......
...@@ -224,7 +224,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker ...@@ -224,7 +224,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
await binding.pump(duration, phase); await binding.pump(duration, phase);
count += 1; count += 1;
} }
}).then/*<int>*/((Null _) => count); }).then<int>((Null _) => count);
} }
@override @override
......
...@@ -120,7 +120,7 @@ Future<Null> main(List<String> args) async { ...@@ -120,7 +120,7 @@ Future<Null> main(List<String> args) async {
context.putIfAbsent(SimControl, () => new SimControl()); context.putIfAbsent(SimControl, () => new SimControl());
context.putIfAbsent(Usage, () => new Usage()); context.putIfAbsent(Usage, () => new Usage());
return Chain.capture/*<Future<Null>>*/(() async { return Chain.capture<Future<Null>>(() async {
await runner.run(args); await runner.run(args);
_exit(0); _exit(0);
}, onError: (dynamic error, Chain chain) { }, onError: (dynamic error, Chain chain) {
......
...@@ -19,7 +19,7 @@ ProcessManager get processManager => context[ProcessManager]; ...@@ -19,7 +19,7 @@ ProcessManager get processManager => context[ProcessManager];
const String _kManifestName = 'MANIFEST.txt'; const String _kManifestName = 'MANIFEST.txt';
bool _areListsEqual/*<T>*/(List<dynamic/*=T*/> list1, List<dynamic/*=T*/> list2) { bool _areListsEqual<T>(List<T> list1, List<T> list2) {
int i = 0; int i = 0;
return list1 != null return list1 != null
&& list2 != null && list2 != null
......
...@@ -94,7 +94,7 @@ class AnalyzeContinuously extends AnalyzeBase { ...@@ -94,7 +94,7 @@ class AnalyzeContinuously extends AnalyzeBase {
printTrace('error code: ${error.code}'); printTrace('error code: ${error.code}');
} }
dumpErrors(errors.map/*<String>*/((AnalysisError error) => error.toLegacyString())); dumpErrors(errors.map<String>((AnalysisError error) => error.toLegacyString()));
// Print an analysis summary. // Print an analysis summary.
String errorsMessage; String errorsMessage;
......
...@@ -183,7 +183,7 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -183,7 +183,7 @@ class AnalyzeOnce extends AnalyzeBase {
printError(error.asString()); printError(error.asString());
errorCount += 1; errorCount += 1;
} }
dumpErrors(errors.map/*<String>*/((AnalysisErrorDescription error) => error.asString())); dumpErrors(errors.map<String>((AnalysisErrorDescription error) => error.asString()));
stopwatch.stop(); stopwatch.stop();
String elapsed = (stopwatch.elapsedMilliseconds / 1000.0).toStringAsFixed(1); String elapsed = (stopwatch.elapsedMilliseconds / 1000.0).toStringAsFixed(1);
......
...@@ -323,7 +323,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -323,7 +323,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
// And since analyzer refuses to look at paths that end in "packages/": // And since analyzer refuses to look at paths that end in "packages/":
result.addAll( result.addAll(
_gatherProjectPaths(path.join(rootPath, 'packages')) _gatherProjectPaths(path.join(rootPath, 'packages'))
.map/*<Directory>*/((String path) => fs.directory(path)) .map<Directory>((String path) => fs.directory(path))
); );
return result; return result;
} }
......
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