Move to real generic method syntax (#7235)

This commit is contained in:
Ian Hickson 2017-01-21 20:58:44 -08:00 committed by GitHub
parent 2e196037f5
commit 15a7eb3b6c
60 changed files with 154 additions and 157 deletions

View file

@ -278,12 +278,11 @@ String requireEnvVar(String name) {
return value;
}
dynamic/*=T*/ requireConfigProperty/*<T>*/(
Map<String, dynamic/*<T>*/ > map, String propertyName) {
T requireConfigProperty<T>(Map<String, dynamic> map, String propertyName) {
if (!map.containsKey(propertyName))
fail('Configuration property not found: $propertyName');
return map[propertyName];
T result = map[propertyName];
return result;
}
String jsonEncode(dynamic data) {

View file

@ -411,7 +411,7 @@ class CardCollectionState extends State<CardCollection> {
cardCollection = new ScrollableList(
snapOffsetCallback: _snapToCenter ? _toSnapOffset : null,
itemExtent: kFixedCardHeight,
children: _cardIndices.map/*<Widget>*/((int index) => _buildCard(context, index))
children: _cardIndices.map<Widget>((int index) => _buildCard(context, index))
);
} else {
cardCollection = new LazyBlock(

View file

@ -77,15 +77,15 @@ class DesertDataSource extends DataTableSource {
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) {
if (!ascending) {
final Desert c = a;
a = b;
b = c;
}
final Comparable<dynamic/*=T*/> aValue = getField(a);
final Comparable<dynamic/*=T*/> bValue = getField(b);
final Comparable<T> aValue = getField(a);
final Comparable<T> bValue = getField(b);
return Comparable.compare(aValue, bValue);
});
notifyListeners();
@ -153,8 +153,8 @@ class _DataTableDemoState extends State<DataTableDemo> {
bool _sortAscending = true;
DesertDataSource _desertsDataSource = new DesertDataSource();
void _sort/*<T>*/(Comparable<dynamic/*=T*/> getField(Desert d), int columnIndex, bool ascending) {
_desertsDataSource._sort/*<T>*/(getField, ascending);
void _sort<T>(Comparable<T> getField(Desert d), int columnIndex, bool ascending) {
_desertsDataSource._sort<T>(getField, ascending);
setState(() {
_sortColumnIndex = columnIndex;
_sortAscending = ascending;
@ -178,44 +178,44 @@ class _DataTableDemoState extends State<DataTableDemo> {
columns: <DataColumn>[
new DataColumn(
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(
label: new Text('Calories'),
tooltip: 'The total amount of food energy in the given serving size.',
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(
label: new Text('Fat (g)'),
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(
label: new Text('Carbs (g)'),
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(
label: new Text('Protein (g)'),
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(
label: new Text('Sodium (mg)'),
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(
label: new Text('Calcium (%)'),
tooltip: 'The amount of calcium as a percentage of the recommended daily amount.',
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(
label: new Text('Iron (%)'),
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

View file

@ -65,12 +65,12 @@ class DialogDemoState extends State<DialogDemo> {
_selectedTime = new TimeOfDay(hour: now.hour, minute: now.minute);
}
void showDemoDialog/*<T>*/({ BuildContext context, Widget child }) {
showDialog/*<T>*/(
void showDemoDialog<T>({ BuildContext context, Widget child }) {
showDialog<T>(
context: context,
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) {
_scaffoldKey.currentState.showSnackBar(new SnackBar(
content: new Text('You selected: $value')
@ -95,7 +95,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton(
child: new Text('ALERT'),
onPressed: () {
showDemoDialog/*<DialogDemoAction>*/(
showDemoDialog<DialogDemoAction>(
context: context,
child: new AlertDialog(
content: new Text(
@ -119,7 +119,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton(
child: new Text('ALERT WITH TITLE'),
onPressed: () {
showDemoDialog/*<DialogDemoAction>*/(
showDemoDialog<DialogDemoAction>(
context: context,
child: new AlertDialog(
title: new Text('Use Google\'s location service?'),
@ -144,7 +144,7 @@ class DialogDemoState extends State<DialogDemo> {
new RaisedButton(
child: new Text('SIMPLE'),
onPressed: () {
showDemoDialog/*<String>*/(
showDemoDialog<String>(
context: context,
child: new SimpleDialog(
title: new Text('Set backup account'),

View file

@ -15,7 +15,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
child: new RaisedButton(
child: new Text('SHOW BOTTOM SHEET'),
onPressed: () {
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
return new Container(
child: new Padding(
padding: const EdgeInsets.all(32.0),

View file

@ -27,7 +27,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
setState(() { // disable the button
_showBottomSheetCallback = null;
});
_scaffoldKey.currentState.showBottomSheet/*<Null>*/((BuildContext context) {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
final ThemeData themeData = Theme.of(context);
return new Container(
decoration: new BoxDecoration(

View file

@ -51,7 +51,7 @@ class ShrinePageState extends State<ShrinePage> {
}
void _showShoppingCart() {
showModalBottomSheet/*<Null>*/(context: context, builder: (BuildContext context) {
showModalBottomSheet<Null>(context: context, builder: (BuildContext context) {
if (config.shoppingCart.isEmpty) {
return new Padding(
padding: const EdgeInsets.all(24.0),

View file

@ -80,7 +80,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
if (!_formWasEdited || form.validate())
return new Future<bool>.value(true);
return showDialog/*<bool>*/(
return showDialog<bool>(
context: context,
child: new AlertDialog(
title: new Text('This form has errors'),

View file

@ -300,7 +300,7 @@ class StockHomeState extends State<StockHome> {
}
void _handleCreateCompany() {
showModalBottomSheet/*<Null>*/(
showModalBottomSheet<Null>(
context: context,
builder: (BuildContext context) => new _CreateCompanySheet()
);

View file

@ -161,8 +161,8 @@ class CachingIterable<E> extends IterableBase<E> {
}
@override
Iterable<dynamic/*=T*/> map/*<T>*/(/*=T*/ f(E e)) {
return new CachingIterable<dynamic/*=T*/>(super.map/*<T>*/(f).iterator);
Iterable<T> map<T>(T f(E e)) {
return new CachingIterable<T>(super.map<T>(f).iterator);
}
@override
@ -171,8 +171,8 @@ class CachingIterable<E> extends IterableBase<E> {
}
@override
Iterable<dynamic/*=T*/> expand/*<T>*/(Iterable/*<T>*/ f(E element)) {
return new CachingIterable<dynamic/*=T*/>(super.expand/*<T>*/(f).iterator);
Iterable<T> expand<T>(Iterable<T> f(E element)) {
return new CachingIterable<T>(super.expand<T>(f).iterator);
}
@override

View file

@ -34,11 +34,11 @@ class SynchronousFuture<T> implements Future<T> {
Future<T> catchError(Function onError, { bool test(dynamic error) }) => new Completer<T>().future;
@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);
if (result is Future<dynamic/*=E*/>)
if (result is Future<E>)
return result;
return new SynchronousFuture<dynamic/*=E*/>(result);
return new SynchronousFuture<E>(result);
}
@override

View file

@ -275,7 +275,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
_initialPosition = event.position;
_pendingDragOffset = Offset.zero;
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 {
Offset delta = event.delta;
if (_state == _DragState.accepted) {
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),
primaryDelta: _getPrimaryValueFromOffset(delta),
globalPosition: event.position,
@ -311,12 +311,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
Offset delta = _pendingDragOffset;
_pendingDragOffset = Offset.zero;
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,
)));
}
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),
primaryDelta: _getPrimaryValueFromOffset(delta),
globalPosition: _initialPosition,
@ -336,7 +336,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
resolve(GestureDisposition.rejected);
_state = _DragState.ready;
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;
}
bool wasAccepted = (_state == _DragState.accepted);
@ -350,12 +350,12 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
final Offset pixelsPerSecond = velocity.pixelsPerSecond;
if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * 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,
primaryVelocity: _getPrimaryValueFromOffset(velocity.pixelsPerSecond),
)));
} 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,
primaryVelocity: 0.0,
)));

View file

@ -26,7 +26,7 @@ class LongPressGestureRecognizer extends PrimaryPointerGestureRecognizer {
void didExceedDeadline() {
resolve(GestureDisposition.accepted);
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

View file

@ -261,7 +261,7 @@ abstract class MultiDragGestureRecognizer<T extends MultiDragPointerState> exten
assert(state._pendingDelta != null);
Drag drag;
if (onStart != null)
drag = invokeCallback/*<Drag>*/('onStart', () => onStart(initialPosition));
drag = invokeCallback<Drag>('onStart', () => onStart(initialPosition));
if (drag != null) {
state._startDrag(drag);
} else {

View file

@ -191,7 +191,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
_freezeTracker(tracker);
_trackers.remove(tracker.pointer);
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();
}
@ -352,7 +352,7 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
longTapDelay: longTapDelay
);
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
@ -372,22 +372,22 @@ class MultiTapGestureRecognizer extends GestureRecognizer {
assert(_gestureMap.containsKey(pointer));
_gestureMap.remove(pointer);
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) {
assert(_gestureMap.containsKey(pointer));
_gestureMap.remove(pointer);
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)
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) {
assert(_gestureMap.containsKey(pointer));
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

View file

@ -59,8 +59,8 @@ abstract class GestureRecognizer extends GestureArenaMember {
/// Invoke a callback provided by the application, catching and logging any
/// exceptions.
@protected
dynamic/*=T*/ invokeCallback/*<T>*/(String name, RecognizerCallback<dynamic/*=T*/> callback) {
dynamic/*=T*/ result;
T invokeCallback<T>(String name, RecognizerCallback<T> callback) {
T result;
try {
result = callback();
} catch (exception, stack) {

View file

@ -180,9 +180,9 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
final Offset pixelsPerSecond = velocity.pixelsPerSecond;
if (pixelsPerSecond.distanceSquared > kMaxFlingVelocity * 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 {
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;
@ -200,11 +200,11 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
if (_state == ScaleState.accepted && !configChanged) {
_state = ScaleState.started;
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)
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

View file

@ -99,7 +99,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
void resolve(GestureDisposition disposition) {
if (_wonArenaForPrimaryPointer && disposition == GestureDisposition.rejected) {
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();
}
super.resolve(disposition);
@ -126,7 +126,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
if (pointer == primaryPointer) {
assert(state == GestureRecognizerState.defunct);
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();
}
}
@ -134,7 +134,7 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
void _checkDown() {
if (!_sentTapDown) {
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;
}
}
@ -143,9 +143,9 @@ class TapGestureRecognizer extends PrimaryPointerGestureRecognizer {
if (_wonArenaForPrimaryPointer && _finalPosition != null) {
resolve(GestureDisposition.accepted);
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)
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();
}
}

View file

@ -161,7 +161,7 @@ Future<String> read(dynamic url, {Map<String, String> headers}) =>
Future<Uint8List> readBytes(dynamic url, {Map<String, String> 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();
try {
return await fn(client);

View file

@ -62,7 +62,7 @@ class IOClient extends BaseClient {
});
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),
test: (dynamic error) => io.isHttpException(error)),
response.statusCode,

View file

@ -85,7 +85,7 @@ ByteStream toByteStream(Stream<List<int>> stream) {
/// Calls [onDone] once [stream] (a single-subscription [Stream]) is finished.
/// The return value, also a single-subscription [Stream] should be used in
/// 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
sink.close();
onDone();

View file

@ -147,7 +147,7 @@ void showAboutDialog({
String applicationLegalese,
List<Widget> children
}) {
showDialog/*<Null>*/(
showDialog<Null>(
context: context,
child: new AboutDialog(
applicationName: applicationName,

View file

@ -163,10 +163,10 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[
typedef dynamic _KeyFunc<T>(T input);
// Select the element for which the key function returns the maximum value.
dynamic/*=T*/ _maxBy/*<T>*/(Iterable<dynamic/*=T*/> input, _KeyFunc/*<T>*/ keyFunc) {
dynamic/*=T*/ maxValue;
T _maxBy<T>(Iterable<T> input, _KeyFunc<T> keyFunc) {
T maxValue;
dynamic maxKey;
for (dynamic/*=T*/ value in input) {
for (T value in input) {
dynamic key = keyFunc(value);
if (maxKey == null || key > maxKey) {
maxValue = value;
@ -200,7 +200,7 @@ class MaterialRectArcTween extends RectTween {
assert(begin != null);
assert(end != null);
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(
begin: _cornerFor(begin, _diagonal.beginId),
end: _cornerFor(end, _diagonal.beginId)

View file

@ -256,10 +256,10 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
/// * [BottomSheet]
/// * [Scaffold.showBottomSheet]
/// * <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(builder != null);
return Navigator.push(context, new _ModalBottomSheetRoute<dynamic/*=T*/>(
return Navigator.push(context, new _ModalBottomSheetRoute<T>(
builder: builder,
theme: Theme.of(context, shadowThemeOnly: true),
));

View file

@ -57,7 +57,7 @@ class ButtonBar extends StatelessWidget {
child: new Row(
mainAxisAlignment: alignment,
mainAxisSize: mainAxisSize,
children: children.map/*<Widget>*/((Widget child) {
children: children.map<Widget>((Widget child) {
return new Padding(
padding: new EdgeInsets.symmetric(horizontal: paddingUnit),
child: child

View file

@ -361,11 +361,11 @@ class _DialogRoute<T> extends PopupRoute<T> {
/// * [AlertDialog], for dialogs that have a row of buttons below the body.
/// * [Dialog], on which [SimpleDialog] and [AlertDialog] are based.
/// * <https://material.google.com/components/dialogs.html>
Future<dynamic/*=T*/> showDialog/*<T>*/({
Future<T> showDialog<T>({
@required BuildContext context,
@required Widget child
}) {
return Navigator.push(context, new _DialogRoute<dynamic/*=T*/>(
return Navigator.push(context, new _DialogRoute<T>(
child: child,
theme: Theme.of(context, shadowThemeOnly: true),
));

View file

@ -221,13 +221,13 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
DataRow _getBlankRowFor(int index) {
return new DataRow.byIndex(
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) {
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) {
haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator());
@ -291,7 +291,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
}
if (config.actions != null) {
headerWidgets.addAll(
config.actions.map/*<Widget>*/((Widget widget) {
config.actions.map<Widget>((Widget widget) {
return new Padding(
// 8.0 is the default padding of an icon button
padding: const EdgeInsets.only(left: 24.0 - 8.0 * 2.0),
@ -307,7 +307,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
if (config.onRowsPerPageChanged != null) {
List<Widget> availableRowsPerPage = config.availableRowsPerPage
.where((int value) => value <= _rowCount)
.map/*<DropdownMenuItem<int>>*/((int value) {
.map<DropdownMenuItem<int>>((int value) {
return new DropdownMenuItem<int>(
value: value,
child: new Text('$value')

View file

@ -437,16 +437,16 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
/// 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
/// menus.
Future<dynamic/*=T*/> showMenu/*<T>*/({
Future<T> showMenu<T>({
BuildContext context,
RelativeRect position,
List<PopupMenuEntry<dynamic/*=T*/>> items,
dynamic/*=T*/ initialValue,
List<PopupMenuEntry<T>> items,
T initialValue,
int elevation: 8
}) {
assert(context != null);
assert(items != null && items.isNotEmpty);
return Navigator.push(context, new _PopupMenuRoute<dynamic/*=T*/>(
return Navigator.push(context, new _PopupMenuRoute<T>(
position: position,
items: items,
initialValue: initialValue,
@ -525,7 +525,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
void showButtonMenu() {
final RenderBox renderBox = context.findRenderObject();
final Point topLeft = renderBox.localToGlobal(Point.origin);
showMenu/*<T>*/(
showMenu<T>(
context: context,
elevation: config.elevation,
items: config.itemBuilder(context),

View file

@ -676,12 +676,12 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
/// sheet.
/// * [Scaffold.of], for information about how to obtain the [ScaffoldState].
/// * <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) {
_currentBottomSheet.close();
assert(_currentBottomSheet == null);
}
Completer<dynamic/*=T*/> completer = new Completer<dynamic/*=T*/>();
Completer<T> completer = new Completer<T>();
GlobalKey<_PersistentBottomSheetState> bottomSheetKey = new GlobalKey<_PersistentBottomSheetState>();
AnimationController controller = BottomSheet.createAnimationController(this)
..forward();
@ -717,7 +717,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
);
ModalRoute.of(context).addLocalHistoryEntry(entry);
setState(() {
_currentBottomSheet = new PersistentBottomSheetController<dynamic/*=T*/>._(
_currentBottomSheet = new PersistentBottomSheetController<T>._(
bottomSheet,
completer,
() => entry.remove(),

View file

@ -643,7 +643,7 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
size = constraints.constrain(gridSize);
if (callback != null)
invokeLayoutCallback/*<BoxConstraints>*/(callback);
invokeLayoutCallback<BoxConstraints>(callback);
double gridTopPadding = 0.0;
double gridLeftPadding = 0.0;

View file

@ -153,7 +153,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
}
if (callback != null)
invokeLayoutCallback/*<BoxConstraints>*/(callback);
invokeLayoutCallback<BoxConstraints>(callback);
double itemWidth;
double itemHeight;

View file

@ -1824,7 +1824,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
///
/// This function can only be called during layout.
@protected
void invokeLayoutCallback/*<T extends Constraints>*/(LayoutCallback/*<T>*/ callback) {
void invokeLayoutCallback<T extends Constraints>(LayoutCallback<T> callback) {
assert(_debugMutationsLocked);
assert(_debugDoingThisLayout);
assert(!_doingThisLayoutWithCallback);
@ -2413,7 +2413,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
debugFillDescription(description);
result += description
.expand((String description) => debugWordWrap(description, 65, wrapIndent: ' '))
.map/*<String>*/((String line) => "$descriptionPrefix$line\n")
.map<String>((String line) => "$descriptionPrefix$line\n")
.join();
if (childrenDescription == '')
result += '$prefixOtherLines\n';

View file

@ -375,8 +375,8 @@ class DragTarget<T> extends StatefulWidget {
_DragTargetState<T> createState() => new _DragTargetState<T>();
}
List/*<T>*/ _mapAvatarsToData/*<T>*/(List/*<_DragAvatar<T>>*/ avatars) {
return avatars.map/*<T>*/((_DragAvatar/*<T>*/ avatar) => avatar.data).toList();
List<T> _mapAvatarsToData<T>(List<_DragAvatar<T>> avatars) {
return avatars.map<T>((_DragAvatar<T> avatar) => avatar.data).toList();
}
class _DragTargetState<T> extends State<DragTarget<T>> {
@ -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(_rejectedAvatars))
);
}
}

View file

@ -454,7 +454,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
if (_recognizers == null) {
description.add('DISPOSED');
} 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)
gestures.add('<none>');
description.add('gestures: ${gestures.join(", ")}');

View file

@ -100,7 +100,7 @@ class Table extends RenderObjectWidget {
this.textBaseline
}) : children = children,
_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,
super(key: key) {
assert(children != null);
@ -246,7 +246,7 @@ class _TableElement extends RenderObjectElement {
_children = widget.children.map((TableRow row) {
return new _TableElementRow(
key: row.key,
children: row.children.map/*<Element>*/((Widget child) {
children: row.children.map<Element>((Widget child) {
assert(child != null);
return inflateWidget(child, null);
}).toList(growable: false)

View file

@ -313,7 +313,7 @@ void main() {
new Scaffold(body: new Container(key: testKey))
);
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 {
@ -322,7 +322,7 @@ void main() {
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.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 {
@ -331,7 +331,7 @@ void main() {
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.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 {
@ -340,7 +340,7 @@ void main() {
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.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));
});
});
}

View file

@ -155,7 +155,7 @@ void main() {
testWidgets('Form.willPop callbacks do not accumulate', (WidgetTester tester) async {
Future<bool> showYesNoAlert(BuildContext context) {
return showDialog/*<bool>*/(
return showDialog<bool>(
context: context,
child: new AlertDialog(
actions: <Widget> [

View file

@ -18,7 +18,7 @@ void main() {
)
));
bottomSheet = scaffoldKey.currentState.showBottomSheet/*<Null>*/((_) {
bottomSheet = scaffoldKey.currentState.showBottomSheet<Null>((_) {
return new Builder(
builder: (BuildContext context) {
buildCount += 1;

View file

@ -23,7 +23,7 @@ void main() {
expect(find.text('BottomSheet'), findsNothing);
bool showBottomSheetThenCalled = false;
showModalBottomSheet/*<Null>*/(
showModalBottomSheet<Null>(
context: savedContext,
builder: (BuildContext context) => new Text('BottomSheet')
).then((Null result) {
@ -45,7 +45,7 @@ void main() {
expect(find.text('BottomSheet'), findsNothing);
showBottomSheetThenCalled = false;
showModalBottomSheet/*<Null>*/(
showModalBottomSheet<Null>(
context: savedContext,
builder: (BuildContext context) => new Text('BottomSheet'),
).then((Null result) {

View file

@ -206,7 +206,7 @@ void main() {
middle = part2;
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);
state.oldBuilt = state.built;
state.trigger();
@ -219,7 +219,7 @@ void main() {
didMiddle = false;
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, isNot(equals(state.oldBuilt)));
}

View file

@ -133,10 +133,10 @@ Widget buildImageAtRatio(String image, Key key, double ratio, bool inferSize) {
}
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) {
return tester.renderObject/*<RenderImage>*/(find.byKey(key)).image;
return tester.renderObject<RenderImage>(find.byKey(key)).image;
}
Future<Null> pumpTreeToLayout(WidgetTester tester, Widget widget) {

View file

@ -66,7 +66,7 @@ void main() {
})
));
frame += 1;
tester.state/*<SizeChangerState>*/(find.byType(SizeChanger)).trigger();
tester.state<SizeChangerState>(find.byType(SizeChanger)).trigger();
await tester.pump();
});
}

View file

@ -26,7 +26,7 @@ class PersistentBottomSheetTestState extends State<PersistentBottomSheetTest> {
bool setStateCalled = false;
void showBottomSheet() {
_scaffoldKey.currentState.showBottomSheet/*<Null>*/((BuildContext context) {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
return new Text('bottomSheet');
})
.closed.then((_) {

View file

@ -60,7 +60,7 @@ Future<Null> performTest(WidgetTester tester, bool maintainState) async {
expect(find.text('100'), findsNothing);
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);
await tester.pump(const Duration(seconds: 1));
expect(completer.isCompleted, isTrue);

View file

@ -71,7 +71,7 @@ void main() {
expect(StatefulCreationCounterState.creationCount, 0);
await tester.pumpWidget(new Bar());
expect(StatefulCreationCounterState.creationCount, 1);
BarState s = tester.state/*<BarState>*/(find.byType(Bar));
BarState s = tester.state<BarState>(find.byType(Bar));
s.trigger();
await tester.pump();
expect(StatefulCreationCounterState.creationCount, 1);

View file

@ -14,7 +14,7 @@ void main() {
));
ScrollableState scrollable =
tester.state/*<ScrollableState>*/(find.byType(Scrollable));
tester.state<ScrollableState>(find.byType(Scrollable));
expect(scrollable.scrollOffset, equals(0.0));

View file

@ -20,7 +20,7 @@ void main() {
await tester.fling(find.byType(Scrollable), const Offset(0.0, -200.0), 1000.0);
await tester.pump();
tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip();
tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
await tester.pump(const Duration(hours: 5));
});
}

View file

@ -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) {
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))
).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
).toList();
expect(actualPositions, equals(idealPositions));
@ -34,7 +34,7 @@ void verify(WidgetTester tester, List<Point> idealPositions, List<bool> idealVis
void main() {
testWidgets('Viewport2 basic test', (WidgetTester tester) async {
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>[
const Point(0.0, 0.0),
const Point(0.0, 400.0),
@ -73,7 +73,7 @@ void main() {
testWidgets('Viewport2 anchor test', (WidgetTester tester) async {
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>[
const Point(0.0, 100.0),
const Point(0.0, 500.0),

View file

@ -89,10 +89,10 @@ class FooScrollConfiguration extends ScrollConfigurationDelegate {
void main() {
testWidgets('https://github.com/flutter/flutter/issues/5630', (WidgetTester tester) async {
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.pump();
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);
});
}

View file

@ -54,5 +54,5 @@ class FlipWidgetState extends State<FlipWidget> {
}
void flipStatefulWidget(WidgetTester tester) {
tester.state/*<FlipWidgetState>*/(find.byType(FlipWidget)).flip();
tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
}

View file

@ -40,13 +40,13 @@ void main() {
},
));
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);
await tester.pump();
expect(tester.binding.transientCallbackCount, 2);
await tester.pump(const Duration(seconds: 5));
expect(tester.binding.transientCallbackCount, 0);
tester.state/*<NavigatorState>*/(find.byType(Navigator)).pop();
tester.state<NavigatorState>(find.byType(Navigator)).pop();
expect(tester.binding.transientCallbackCount, 1);
await tester.pump();
expect(tester.binding.transientCallbackCount, 2);

View file

@ -196,7 +196,7 @@ class FlutterDriver {
// option, then the VM service extension is not registered yet. Wait for
// it to be registered.
Future<dynamic> whenResumed = resumeLeniently();
Future<dynamic> whenServiceExtensionReady = Future.any/*<dynamic>*/(<Future<dynamic>>[
Future<dynamic> whenServiceExtensionReady = Future.any<dynamic>(<Future<dynamic>>[
waitForServiceExtension(),
// We will never receive the extension event if the user does not
// register it. If that happens time out.
@ -452,9 +452,9 @@ class FlutterDriver {
/// With frame sync disabled, its the responsibility of the test author to
/// ensure that no action is performed while the app is undergoing a
/// 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));
dynamic/*=T*/ result;
T result;
try {
result = await action();
} finally {

View file

@ -160,7 +160,7 @@ class TimelineSummary {
if (events.length == 0)
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;
}
@ -169,7 +169,7 @@ class TimelineSummary {
return null;
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));
}

View file

@ -52,7 +52,7 @@ class WidgetController {
///
/// * 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.
Widget/*=T*/ widget/*<T extends Widget>*/(Finder finder) {
T widget<T extends Widget>(Finder finder) {
TestAsyncUtils.guardSync();
return finder.evaluate().single.widget;
}
@ -63,7 +63,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty.
///
/// * 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();
return finder.evaluate().first.widget;
}
@ -72,11 +72,10 @@ class WidgetController {
///
/// * Use [widget] if you only expect to match one widget.
/// * 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();
return finder.evaluate().map/*<T>*/((Element element) {
// TODO(ianh): simplify once the VM can infer the return type
dynamic/*=T*/ result = element.widget;
return finder.evaluate().map<T>((Element element) {
T result = element.widget;
return result;
});
}
@ -99,7 +98,7 @@ class WidgetController {
///
/// * 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.
Element/*=T*/ element/*<T extends Element>*/(Finder finder) {
T element<T extends Element>(Finder finder) {
TestAsyncUtils.guardSync();
return finder.evaluate().single;
}
@ -110,7 +109,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty.
///
/// * 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();
return finder.evaluate().first;
}
@ -119,7 +118,7 @@ class WidgetController {
///
/// * Use [element] if you only expect to match one element.
/// * 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();
return finder.evaluate();
}
@ -144,9 +143,9 @@ class WidgetController {
///
/// * 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.
State/*=T*/ state/*<T extends State>*/(Finder finder) {
T state<T extends State>(Finder finder) {
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
@ -156,9 +155,9 @@ class WidgetController {
/// matching widget has no 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();
return _stateOf/*<T>*/(finder.evaluate().first, finder);
return _stateOf<T>(finder.evaluate().first, finder);
}
/// The matching states in the widget tree.
@ -168,12 +167,12 @@ class WidgetController {
///
/// * Use [state] if you only expect to match one state.
/// * 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();
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();
if (element is StatefulElement)
return element.state;
@ -201,7 +200,7 @@ class WidgetController {
///
/// * 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.
RenderObject/*=T*/ renderObject/*<T extends RenderObject>*/(Finder finder) {
T renderObject<T extends RenderObject>(Finder finder) {
TestAsyncUtils.guardSync();
return finder.evaluate().single.renderObject;
}
@ -212,7 +211,7 @@ class WidgetController {
/// Throws a [StateError] if `finder` is empty.
///
/// * 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();
return finder.evaluate().first.renderObject;
}
@ -221,11 +220,10 @@ class WidgetController {
///
/// * Use [renderObject] if you only expect to match one render object.
/// * 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();
return finder.evaluate().map/*<T>*/((Element element) {
// TODO(ianh): simplify once the VM can infer the return type
dynamic/*=T*/ result = element.renderObject;
return finder.evaluate().map<T>((Element element) {
T result = element.renderObject;
return result;
});
}

View file

@ -224,7 +224,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
await binding.pump(duration, phase);
count += 1;
}
}).then/*<int>*/((Null _) => count);
}).then<int>((Null _) => count);
}
@override

View file

@ -120,7 +120,7 @@ Future<Null> main(List<String> args) async {
context.putIfAbsent(SimControl, () => new SimControl());
context.putIfAbsent(Usage, () => new Usage());
return Chain.capture/*<Future<Null>>*/(() async {
return Chain.capture<Future<Null>>(() async {
await runner.run(args);
_exit(0);
}, onError: (dynamic error, Chain chain) {

View file

@ -19,7 +19,7 @@ ProcessManager get processManager => context[ProcessManager];
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;
return list1 != null
&& list2 != null

View file

@ -94,7 +94,7 @@ class AnalyzeContinuously extends AnalyzeBase {
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.
String errorsMessage;

View file

@ -183,7 +183,7 @@ class AnalyzeOnce extends AnalyzeBase {
printError(error.asString());
errorCount += 1;
}
dumpErrors(errors.map/*<String>*/((AnalysisErrorDescription error) => error.asString()));
dumpErrors(errors.map<String>((AnalysisErrorDescription error) => error.asString()));
stopwatch.stop();
String elapsed = (stopwatch.elapsedMilliseconds / 1000.0).toStringAsFixed(1);

View file

@ -323,7 +323,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
// And since analyzer refuses to look at paths that end in "packages/":
result.addAll(
_gatherProjectPaths(path.join(rootPath, 'packages'))
.map/*<Directory>*/((String path) => fs.directory(path))
.map<Directory>((String path) => fs.directory(path))
);
return result;
}