File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import 'package:mrx_charts/models/touchable/arc_shape.dart';
1919import 'package:mrx_charts/models/touchable/rectangle_shape.dart' ;
2020import 'package:mrx_charts/models/touchable/touchable_shape.dart' ;
2121import 'package:mrx_charts/touch/stock_touch_callback_data.dart' ;
22- import 'package:collection/collection.dart' ;
2322import 'package:flutter/material.dart' ;
2423
2524part 'chart_axis_painter.dart' ;
@@ -296,6 +295,29 @@ extension _ListExtensions<T> on List<T> {
296295 T ? get lastOrNull => isNotEmpty ? last : null ;
297296
298297 T ? getOrNull (int index) => length > index ? this [index] : null ;
298+
299+ T ? firstWhereOrNull (bool Function (T element) test) {
300+ for (var element in this ) {
301+ if (test (element)) return element;
302+ }
303+ return null ;
304+ }
305+ }
306+
307+ extension _IterableExtensions <T > on Iterable <T > {
308+ List <T > copy () => [...this ];
309+
310+ List <T > sorted (Comparator <T > compare) => copy ()..sort (compare);
311+ }
312+
313+ extension _IterableDoubleExtensions on Iterable <double > {
314+ double get sum {
315+ double result = 0.0 ;
316+ for (double value in this ) {
317+ result += value;
318+ }
319+ return result;
320+ }
299321}
300322
301323extension _ListTextPainterExtensions on List <TextPainter > {
You can’t perform that action at this time.
0 commit comments