Unverified Commit 1d8ac6d4 authored by Leaf Petersen's avatar Leaf Petersen Committed by GitHub

Remaining code changes for Dart 2.0 SDK roll. (#13741)

* Remaining code changes for Dart 2.0 SDK roll
parent ece737d1
...@@ -498,10 +498,10 @@ Future<Null> _verifyGeneratedPluginRegistrants(String flutterRoot) async { ...@@ -498,10 +498,10 @@ Future<Null> _verifyGeneratedPluginRegistrants(String flutterRoot) async {
final Set<String> outOfDate = new Set<String>(); final Set<String> outOfDate = new Set<String>();
for (String package in packageToRegistrants.keys) { for (String package in packageToRegistrants.keys) {
final Map<File, String> fileToContent = new Map<File, String>.fromIterable(packageToRegistrants[package], final Map<File, String> fileToContent = <File, String>{};
key: (File f) => f, for(File f in packageToRegistrants[package]) {
value: (File f) => f.readAsStringSync(), fileToContent[f] = f.readAsStringSync();
); }
await _runCommand(flutter, <String>['inject-plugins'], await _runCommand(flutter, <String>['inject-plugins'],
workingDirectory: package, workingDirectory: package,
printOutput: false, printOutput: false,
......
...@@ -552,7 +552,8 @@ class Navigator extends StatefulWidget { ...@@ -552,7 +552,8 @@ class Navigator extends StatefulWidget {
/// ///
/// Returns a [Future] that completes to the `result` value passed to [pop] /// Returns a [Future] that completes to the `result` value passed to [pop]
/// when the pushed route is popped off the navigator. /// when the pushed route is popped off the navigator.
static Future<dynamic> push(BuildContext context, Route<dynamic> route) { @optionalTypeArgs
static Future<T> push<T>(BuildContext context, Route<T> route) {
return Navigator.of(context).push(route); return Navigator.of(context).push(route);
} }
...@@ -913,7 +914,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin { ...@@ -913,7 +914,7 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
/// ///
/// Returns a [Future] that completes to the `result` value passed to [pop] /// Returns a [Future] that completes to the `result` value passed to [pop]
/// when the pushed route is popped off the navigator. /// when the pushed route is popped off the navigator.
Future<dynamic> push(Route<dynamic> route) { Future<Object> push(Route<Object> route) {
assert(!_debugLocked); assert(!_debugLocked);
assert(() { _debugLocked = true; return true; }()); assert(() { _debugLocked = true; return true; }());
assert(route != null); assert(route != null);
......
...@@ -592,7 +592,20 @@ class _HasGoodToStringDeep extends Matcher { ...@@ -592,7 +592,20 @@ class _HasGoodToStringDeep extends Matcher {
/// sets of value for which a metric space is defined. /// sets of value for which a metric space is defined.
typedef num DistanceFunction<T>(T a, T b); typedef num DistanceFunction<T>(T a, T b);
const Map<Type, DistanceFunction<dynamic>> _kStandardDistanceFunctions = const <Type, DistanceFunction<dynamic>>{ /// The type of a union of instances of [DistanceFunction<T>] for various types
/// T.
///
/// This type is used to describe a collection of [DistanceFunction<T>]
/// functions which have (potentially) unrelated argument types. Since the
/// argument types of the functions may be unrelated, the only thing that the
/// type system can statically assume about them is that they accept null (since
/// all types in Dart are nullable).
///
/// Calling an instance of this type must either be done dynamically, or by
/// first casting it to a [DistanceFunction<T>] for some concrete T.
typedef num AnyDistanceFunction(Null a, Null b);
const Map<Type, AnyDistanceFunction> _kStandardDistanceFunctions = const <Type, AnyDistanceFunction>{
Color: _maxComponentColorDistance, Color: _maxComponentColorDistance,
Offset: _offsetDistance, Offset: _offsetDistance,
int: _intDistance, int: _intDistance,
......
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