diff --git a/packages/flutter/lib/src/foundation/basic_types.dart b/packages/flutter/lib/src/foundation/basic_types.dart index a6d2ec009e..1884faabc8 100644 --- a/packages/flutter/lib/src/foundation/basic_types.dart +++ b/packages/flutter/lib/src/foundation/basic_types.dart @@ -243,21 +243,3 @@ class _LazyListIterator implements Iterator { return true; } } - -// COLLECTION UTILITIES - -typedef dynamic KeyFunc(T input); - -/// Select the element for which the key function returns the maximum value. -dynamic/*=T*/ maxBy/**/(Iterable input, KeyFunc/**/ keyFunc) { - dynamic/*=T*/ maxValue; - dynamic maxKey; - for (dynamic/*=T*/ value in input) { - dynamic key = keyFunc(value); - if (maxKey == null || key > maxKey) { - maxValue = value; - maxKey = key; - } - } - return maxValue; -} diff --git a/packages/flutter/lib/src/material/arc.dart b/packages/flutter/lib/src/material/arc.dart index 46820c1997..90422cf032 100644 --- a/packages/flutter/lib/src/material/arc.dart +++ b/packages/flutter/lib/src/material/arc.dart @@ -5,7 +5,6 @@ import 'dart:math' as math; import 'dart:ui' show hashValues, lerpDouble; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:meta/meta.dart'; @@ -160,6 +159,22 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[ const _Diagonal(_CornerId.bottomLeft, _CornerId.topRight), ]; +typedef dynamic _KeyFunc(T input); + +// Select the element for which the key function returns the maximum value. +dynamic/*=T*/ _maxBy/**/(Iterable input, _KeyFunc/**/ keyFunc) { + dynamic/*=T*/ maxValue; + dynamic maxKey; + for (dynamic/*=T*/ value in input) { + dynamic key = keyFunc(value); + if (maxKey == null || key > maxKey) { + maxValue = value; + maxKey = key; + } + } + return maxValue; +} + /// A [Tween] that animates a [Rect] from [begin] to [end]. /// /// The rectangle corners whose diagonal is closest to the overall direction of @@ -184,7 +199,7 @@ class MaterialRectArcTween extends RectTween { assert(begin != null); assert(end != null); final Offset centersVector = end.center - begin.center; - _diagonal = maxBy(_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)