fort library

Classes

BinaryReader
The BinaryReader is used to bring data back from the binary format on the disk.
BinaryWriter
The BinaryWriter is used to encode data to the binary format.
Box<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a separate file in the Hive home directory.
BoxBase<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a seperate file in the Hive home directory.
BoxCollection
BoxEvent
A event representing a change in a box.
CallableThunkAction<State>
An interface that can be implemented by end-users to create a class-based ThunkAction.
CallableThunkActionWithExtraArgument<S, A>
An interface that can be implemented by end-users to create a class-based ThunkActionWithExtraArgument.
CollectionBox<V>
represents a Box being part of a BoxCollection
CopyStateWith<T>
Copy with event
DocumentFileEngine
Storage engine to save to application document directory.
ExtraArgumentThunkMiddleware<S, A>
The ExtraArgumentThunkMiddleware works exactly like the normal thunkMiddleware with one difference: It injects the provided "extra argument" into all Thunk functions.
FileStorage
Storage engine to save to file.
FlutterStorage
Storage engine to use with Flutter. Proxy of SharedPreferenceEngine and DocumentFileEngine.
Fort
FortEvent
A class to use to extend all types of Tower Events
FortState<T>
A class to use to extend all types of Tower States
HiveAesCipher
Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
HiveCipher
Abstract cipher can be implemented to customize encryption.
HiveCollection<E extends HiveObjectMixin>
List containing HiveObjectMixins.
HiveField
Annotate all fields you want to persist with HiveField.
HiveInterface
The main API interface of Hive. Available through the Hive constant.
HiveList<E extends HiveObjectMixin>
Allows defining references to other HiveObjectMixins.
HiveObject
HiveType
Annotate classes with HiveType to generate a TypeAdapter.
JsonSerializer<T>
LazyBox<E>
LazyBoxes don't keep the values in memory like normal boxes. Each time a value is read, it is loaded from the backend.
MemoryStorage
Storage engine to save to memory. Do not use in production, this doesn't persist to disk.
MiddlewareClass<State>
Defines a Middleware using a Class interface.
Persistor<T>
Persistor class that saves/loads to/from disk.
RawTransforms
Holds onSave and onLoad raw transformations.
ReducerClass<State>
Defines a Reducer using a class interface.
SetState<T>
Set state event sets the current state to the one provided
SharedPreferencesEngine
Storage engine to save to NSUserDefaults/SharedPreferences. You should only store utf8-encoded data here, like JSON, or base64 data.
StateSerializer<T>
Serializer interface for turning state (T) into Uint8List, and back
StorageEngine
Interface for storage engines
Store<State>
Creates a Redux store that holds the app state tree.
StoreBuilder<S>
Build a Widget by passing the Store directly to the build function.
StoreConnector<S, ViewModel>
Build a widget based on the state of the Store.
StoreProvider<S>
Provides a Redux Store to all descendants of this Widget. This should generally be a root widget in your App. Connect to the Store provided by this Widget using a StoreConnector or StoreBuilder.
StringSerializer
Serializer for a String state
Tower<T, S extends FortState<T>>
Transforms<T>
Holds onSave and onLoad transformations.
TypeAdapter<T>
Type adapters can be implemented to support non primitive values.
TypedMiddleware<State, Action>
A convenience type for binding a piece of Middleware to an Action of a specific type. Allows for Type Safe Middleware and reduces boilerplate.
TypedReducer<State, Action>
A convenience class for binding Reducers to Actions of a given Type. This allows for type safe Reducers and reduces boilerplate.
TypeRegistry
TypeRegistries contain the TypeAdapters associated with a typeId.
WatchBoxBuilder
A general-purpose widget which rebuilds itself when the box or a specific key change.

Enums

FlutterSaveLocation
Location to save state when using Flutter.
HiveStorageBackendPreference
declares the preferred JS StorageBackend to be used

Mixins

HiveObjectMixin
Extend HiveObject to add useful methods to the objects you want to store in Hive

Extensions

BoxX on Box<T>
Flutter extensions for boxes.
HiveX on HiveInterface
Flutter extensions for Hive.
LazyBoxX on LazyBox<T>
Flutter extensions for lazy boxes.

Properties

Hive HiveInterface
Global constant to access Hive.
final

Functions

combineReducers<State>(Iterable<Reducer<State>> reducers) Reducer<State>
Defines a utility function that combines several reducers.
stringToUint8List(String? data) Uint8List?
thunkMiddleware<State>(Store<State> store, dynamic action, NextDispatcher next) → dynamic
The thunkMiddleware intercepts and calls ThunkActions, which is simply a fancy name for any function that takes 1 argument: a Redux Store. This allows you to dispatch functions (aka ThunkActions) to your Store that can perform asynchronous work, then dispatch actions using the Store after the work is complete.
uint8ListToString(Uint8List? data) String?

Typedefs

BoxWidgetBuilder<T> = Widget Function(BuildContext context, Box<T> box)
Signature for a function that builds a widget given a Box.
CompactionStrategy = bool Function(int entries, int deletedEntries)
A function which decides when to compact a box.
IgnoreChangeTest<S> = bool Function(S state)
A test of whether or not your converter function should run in response to a State change. For advanced use only.
KeyComparator = int Function(dynamic key1, dynamic key2)
Middleware<State> = dynamic Function(Store<State> store, dynamic action, NextDispatcher next)
A function that intercepts actions and potentially transform actions before they reach the reducer.
NextDispatcher = dynamic Function(dynamic action)
The contract between one piece of middleware and the next in the chain. Use it to send the current action in your Middleware to the next piece of Middleware in the chain.
OnDidChangeCallback<ViewModel> = void Function(ViewModel? previousViewModel, ViewModel viewModel)
A function that will be run on State change, after the build method.
OnDisposeCallback<S> = void Function(Store<S> store)
A function that will be run when the StoreConnector is removed from the Widget Tree.
OnInitCallback<S> = void Function(Store<S> store)
A function that will be run when the StoreConnector is initialized (using the State.initState method). This can be useful for dispatching actions that fetch data for your Widget when it is first displayed.
OnInitialBuildCallback<ViewModel> = void Function(ViewModel viewModel)
A function that will be run after the Widget is built the first time.
OnWillChangeCallback<ViewModel> = void Function(ViewModel? previousViewModel, ViewModel newViewModel)
A function that will be run on State change, before the build method.
PersistorCallBackFunction<T, S extends FortState<T>> = dynamic Function(Tower<T, S> tower, S loadedState)
RawTransformer = Uint8List Function(Uint8List? data)
Transforms byte state data (immutable). Do not mutate original data. Could be ran with null or empty data.
Reducer<State> = State Function(State state, dynamic action)
Defines an application's state change
SerializationFunction<T extends FortState> = T? Function(dynamic json)
StoreConverter<S, ViewModel> = ViewModel Function(Store<S> store)
Convert the entire Store into a ViewModel. The ViewModel will be used to build a Widget using the ViewModelBuilder.
ThunkAction<State> = dynamic Function(Store<State> store)
A function that can be dispatched as an action to a Redux Store and intercepted by the the thunkMiddleware. It can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met.
ThunkActionWithExtraArgument<S, A> = dynamic Function(Store<S> store, A extraArgument)
A function that can be dispatched as an action to a Redux Store and intercepted by the the ExtraArgumentThunkMiddleware. It can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met.
Transformer<T> = T Function(T? state)
Transforms state to new state. Do not mutate original state. Could be ran with null state.
ViewModelBuilder<ViewModel> = Widget Function(BuildContext context, ViewModel vm)
Build a Widget using the BuildContext and ViewModel. The ViewModel is derived from the Store using a StoreConverter.

Exceptions / Errors

ConverterError
If the StoreConnector throws an error,
HiveError
An error related to Hive.
SerializationException
Serialization failed.
StorageException
Saving/loading failed.
StoreProviderError<S>
If the StoreProvider.of method fails, this error will be thrown.
TransformationException
Transformation failed.