You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class BaseLoaderData with BaseLoaderDataMappable {
final bool isLoading;
final bool isLoadingError;
const BaseLoaderData({
required this.isLoading,
required this.isLoadingError,
});
}
HomeAppData
class HomeAppData extends BaseLoaderData with HomeAppDataMappable {
const HomeAppData(
{super.isLoading = false,
super.isLoadingError = false});
}
The following interface is used by all state mixin to update the state
abstract class StateBaseInterface<T> {
/// Retrieves a mixin reference associated with the stateful class.
///
/// This method can be overridden by classes implementing this interface
/// to provide a reference to a mixin associated with the state.
///
/// Returns `null` by default, indicating that no mixin reference is provided.
@protected
Ref<T>? getMixinRef() => null; // coverage:ignore-line
/// The state property representing the current state of the implementing class.
///
/// Classes implementing this interface should provide a concrete implementation
/// of this property specifying the type [T].
abstract T state;
}
I have the following StateInitMixin which sets two flags after multiple conditions are met and used by multiple notifiers
mixin StateInitMixin<T extends BaseLoaderData>
implements StateBaseInterface<T> {
void init() {
... conditions check
state = state.copyWith(isLoading: true, isLoadingError: false) as T;
// call the initialAPI
callInitial();
}
Future<void> callInitial();
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
Using Mocktail plugin.
Model Classes -Dart Mappable Classes
BaseLoader
HomeAppData
The following interface is used by all state mixin to update the state
I have the following StateInitMixin which sets two flags after multiple conditions are met and used by multiple notifiers
The provider class
The Mock Class for this provider. I thought this is enough to mock the HomeNotifier class
This is the basic test
Error -
Used on a non-mocktail object
Beta Was this translation helpful? Give feedback.
All reactions