import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; Element findElementOfWidget() { return find.byType(T).first.evaluate().first; } Type typeOf() => T; class ValueBuilderMock extends Mock { T call(BuildContext context); } class DisposerMock extends Mock { void call(BuildContext context, T value); } class MockNotifier extends Mock implements ChangeNotifier {} class BuilderMock extends Mock { Widget call(BuildContext context); } class UpdateShouldNotifyMock extends Mock { bool call(T old, T newValue); } class A with DiagnosticableTreeMixin {} class B with DiagnosticableTreeMixin {} class C with DiagnosticableTreeMixin {} class D with DiagnosticableTreeMixin {} class E with DiagnosticableTreeMixin {} class F with DiagnosticableTreeMixin {} class ConsumerBuilderMock extends Mock { Widget call(Combined foo); } class CombinerMock extends Mock { Combined call(BuildContext context, A a, Combined foo); } class ProviderBuilderMock extends Mock { Widget call(BuildContext context, Combined value, Widget child); } class Combined extends DiagnosticableTree { final A a; final B b; final C c; final D d; final E e; final F f; final Combined previous; final BuildContext context; Combined(this.context, this.previous, this.a, [this.b, this.c, this.d, this.e, this.f]); @override // ignore: hash_and_equals bool operator ==(Object other) => other is Combined && other.context == context && other.previous == previous && other.a == a && other.b == b && other.c == c && other.e == e && other.f == f; // fancy toString for debug purposes. @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties.properties.addAll([ DiagnosticsProperty('a', a, defaultValue: null), DiagnosticsProperty('b', b, defaultValue: null), DiagnosticsProperty('c', c, defaultValue: null), DiagnosticsProperty('d', d, defaultValue: null), DiagnosticsProperty('e', e, defaultValue: null), DiagnosticsProperty('f', f, defaultValue: null), DiagnosticsProperty('previous', previous, defaultValue: null), DiagnosticsProperty('context', context, defaultValue: null), ]); } } class MyListenable extends ChangeNotifier {} class MyStream extends Stream { @override StreamSubscription listen(void Function(void event) onData, {Function onError, void Function() onDone, bool cancelOnError}) { return null; } }