Increase the strictness of our requiring explicit types (#7585)
...now that we have generic methods, their types need to be specified too.
This commit is contained in:
@@ -70,7 +70,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
context: context,
|
||||
child: child
|
||||
)
|
||||
.then((T value) { // The value passed to Navigator.pop() or null.
|
||||
.then<Null>((T value) { // The value passed to Navigator.pop() or null.
|
||||
if (value != null) {
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text('You selected: $value')
|
||||
@@ -178,7 +178,7 @@ class DialogDemoState extends State<DialogDemo> {
|
||||
context: context,
|
||||
initialTime: _selectedTime
|
||||
)
|
||||
.then((TimeOfDay value) {
|
||||
.then<Null>((TimeOfDay value) {
|
||||
if (value != null && value != _selectedTime) {
|
||||
_selectedTime = value;
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
|
||||
@@ -48,7 +48,7 @@ class DateTimeItem extends StatelessWidget {
|
||||
firstDate: date.subtract(const Duration(days: 30)),
|
||||
lastDate: date.add(const Duration(days: 30))
|
||||
)
|
||||
.then((DateTime value) {
|
||||
.then<Null>((DateTime value) {
|
||||
onChanged(new DateTime(value.year, value.month, value.day, time.hour, time.minute));
|
||||
});
|
||||
},
|
||||
@@ -74,7 +74,7 @@ class DateTimeItem extends StatelessWidget {
|
||||
context: context,
|
||||
initialTime: time
|
||||
)
|
||||
.then((TimeOfDay value) {
|
||||
.then<Null>((TimeOfDay value) {
|
||||
onChanged(new DateTime(date.year, date.month, date.day, value.hour, value.minute));
|
||||
});
|
||||
},
|
||||
@@ -112,7 +112,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||
|
||||
showDialog(
|
||||
showDialog<DismissDialogAction>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
content: new Text(
|
||||
|
||||
@@ -22,7 +22,6 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
}
|
||||
|
||||
|
||||
void _showBottomSheet() {
|
||||
setState(() { // disable the button
|
||||
_showBottomSheetCallback = null;
|
||||
@@ -45,15 +44,17 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
|
||||
)
|
||||
);
|
||||
})
|
||||
.closed.then((_) {
|
||||
setState(() { // re-enable the button
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
});
|
||||
.closed.whenComplete(() {
|
||||
if (mounted) {
|
||||
setState(() { // re-enable the button
|
||||
_showBottomSheetCallback = _showBottomSheet;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showMessage() {
|
||||
showDialog(
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
content: new Text('You tapped the floating action button.'),
|
||||
|
||||
@@ -66,7 +66,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
|
||||
}
|
||||
|
||||
void _showExplanatoryText() {
|
||||
_scaffoldKey.currentState.showBottomSheet((BuildContext context) {
|
||||
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
|
||||
return new Container(
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(top: new BorderSide(color: Theme.of(context).dividerColor))
|
||||
|
||||
@@ -110,10 +110,12 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
|
||||
|
||||
@override
|
||||
void dependenciesChanged() {
|
||||
getExampleCode(config.exampleCodeTag, DefaultAssetBundle.of(context)).then((String code) {
|
||||
setState(() {
|
||||
_exampleCode = code;
|
||||
});
|
||||
getExampleCode(config.exampleCodeTag, DefaultAssetBundle.of(context)).then<Null>((String code) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_exampleCode = code;
|
||||
});
|
||||
}
|
||||
});
|
||||
super.dependenciesChanged();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class TestAssetBundle extends AssetBundle {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<dynamic> loadStructuredData(String key, Future<dynamic> parser(String value)) async {
|
||||
Future<dynamic> loadStructuredData<T>(String key, Future<T> parser(String value)) async {
|
||||
return parser(await loadString(key));
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ void main() {
|
||||
if (!unsynchedDemoTitles.contains(demoTitle)) {
|
||||
await driver.tap(find.byTooltip('Back'));
|
||||
} else {
|
||||
await driver.runUnsynchronized(() async {
|
||||
await driver.runUnsynchronized<Future<Null>>(() async {
|
||||
await new Future<Null>.delayed(kWaitBetweenActions);
|
||||
await driver.tap(find.byTooltip('Back'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user