This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:isolate'; | |
Future<R> compute<I, R>(R Function(I) f, I input, | |
{String debugName = ''}) async { | |
final resultPort = ReceivePort(); | |
final args = _ComputeArgs<I, R>(resultPort.sendPort, f, input); | |
final isolate = await Isolate.spawn<_ComputeArgs<I, R>>( | |
_compute, | |
args, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:collection'; | |
abstract class MappedListView<T, R> implements List<R> { | |
factory MappedListView( | |
List<T> wrapped, | |
R Function(T element) mapper, | |
) = _MappedListView<T, R>; | |
} | |
class _MappedListView<T, R> with ListMixin<R> implements List<R>, MappedListView<T, R> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LimitingScrollPhysics extends PageScrollPhysics { | |
LimitingScrollPhysics({ScrollPhysics parent, @required this.controller}) | |
: super(parent: parent); | |
final ScrollController controller; | |
@override | |
LimitingScrollPhysics applyTo(ScrollPhysics ancestor) { | |
return LimitingScrollPhysics( | |
parent: buildParent(ancestor), controller: controller); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageAlignedScrollPhysics extends ScrollPhysics { | |
final double pageSize; | |
PageAlignedScrollPhysics({@required this.pageSize, ScrollPhysics parent}) : super(parent: parent); | |
@override | |
PageAlignedScrollPhysics applyTo(ScrollPhysics ancestor) { | |
return PageAlignedScrollPhysics(pageSize: pageSize, parent: buildParent(ancestor)); | |
} |