server library

Classes

AlwaysAliveProviderBase<State>
A base class for providers that never disposes themselves.
AsyncData<T>
Creates an AsyncValue with a data.
AsyncError<T>
Creates an AsyncValue in error state.
AsyncLoading<T>
Creates an AsyncValue in loading state.
AsyncValue<T>
An utility for safely manipulating asynchronous data.
AutoDisposeFutureProvider<State>
A provider that asynchronously creates a single value.
AutoDisposeFutureProviderFamily<State, Arg>
A class that allows building a AutoDisposeFutureProvider from an external parameter.
AutoDisposeFutureProviderRef<State>
An object used by providers to interact with other providers and the life-cycles of the application.
AutoDisposeProvider<State>
A provider that exposes a read-only value.
AutoDisposeProviderBase<State>
A base class for providers that destroy their state when no-longer listened.
AutoDisposeProviderElement<State>
An AutoDisposeProviderElementBase for AutoDisposeProvider
AutoDisposeProviderElementBase<State>
The ProviderElementBase of an AutoDisposeProviderBase.
AutoDisposeProviderFamily<State, Arg>
A class that allows building a Provider from an external parameter.
AutoDisposeProviderRef<State>
An object used by providers to interact with other providers and the life-cycles of the application.
AutoDisposeRef
A Ref for providers that are automatically destroyed when no-longer used.
AutoDisposeStateNotifierProvider<Notifier extends StateNotifier<State>, State>
Creates a StateNotifier and expose its current state.
AutoDisposeStateNotifierProviderFamily<Notifier extends StateNotifier<State>, State, Arg>
A class that allows building a StateNotifierProvider from an external parameter.
AutoDisposeStateNotifierProviderRef<Notifier extends StateNotifier<State>, State>
An object used by providers to interact with other providers and the life-cycles of the application.
AutoDisposeStateProvider<State>
A provider that expose a value which can be modified from outside.
AutoDisposeStateProviderElement<State>
The ProviderElementBase for StateProvider
AutoDisposeStateProviderFamily<State, Arg>
AutoDisposeStateProviderRef<State>
An object used by providers to interact with other providers and the life-cycles of the application.
AutoDisposeStreamProvider<State>
Creates a stream and expose its latest event.
AutoDisposeStreamProviderFamily<State, Arg>
A class that allows building a StreamProvider from an external parameter.
AutoDisposeStreamProviderRef<State>
An object used by providers to interact with other providers and the life-cycles of the application.
BackendProviders
CanBeEmpty
Your own classes can implement this so they may use CanBeEmptyExtension.
ConfigList
  • If isDeepEquals is false, the IList equals operator (==) compares by identity.
  • If isDeepEquals is true (the default), the IList equals operator (==) compares all items, ordered.
  • If cacheHashCode is true (the default), the IList will only calculate the hashCode once, when it is asked — initially, internally null. Otherwise, it will always recalculate it.
  • ConfigMap
  • If isDeepEquals is false, the IMap equals operator (==) compares by identity.
  • If isDeepEquals is true (the default), the IMap equals operator (==) compares all entries, ordered.
  • If sort is true, will sort the list output of keys. Otherwise, it will keep the insertion order (the default).
  • If cacheHashCode is true (the default), the IMap will only calculate the hashCode once, when it is asked — initially, internally null. Otherwise, it will always recalculate it.
  • ConfigMapOfSets
  • If isDeepEquals is false, the IMap equals operator (==) compares by identity.
  • If isDeepEquals is true (the default), the IMap equals operator (==) compares all entries, ordered.
  • If sortKeys is true, will sort the list output of keys. Otherwise, it will keep the insertion order (the default).
  • If cacheHashCode is true (the default), the IMapOfSets will only calculate the hashCode once, when it is asked — initially, internally null. Otherwise, it will always recalculate it.
  • ConfigSet
    The set configuration.
    DiffAndIntersectResult<T, G>
    Entry<K, V>
    Similar to a MapEntry, but correctly implements equals (== comparing key and value), hashcode and Comparable.compareTo.
    Event
    Represents an event of a game
    Family<State, Arg, FamilyProvider extends ProviderBase<State>>
    A base class for all families
    FamilyOverride<Arg>
    Do not use: Internal object to used by ProviderContainer/ProviderScope to override the behavior of a "family" for part of the application.
    FutureLoading<T>
    FutureProvider<State>
    A provider that asynchronously creates a single value.
    FutureProviderFamily<State, Arg>
    A class that allows building a AutoDisposeFutureProvider from an external parameter.
    FutureProviderRef<State>
    An object used by providers to interact with other providers and the life-cycles of the application.
    FutureRefreshing<T>
    FutureValue<T>
    Game<E extends Event>
    Abstract class that all games must inherit from
    GameClient
    A client for a particular game
    GameConfig
    Some general config parameters for a game of gameType
    GameConverter<T extends Game<Event>>
    GameError<G extends Game<Event>>
    GameErrorNotifier
    A companion StateNotifier to the GameStateNotifier that keeps track of the most recent error, and lets the client clear the error
    GameEvent
    An Event that represents either a GenericEvent or a user defined Event for a partiular game
    GameEventGame
    GameEventGeneral
    GameInfo
    An object to provide info about a particular game to the client
    GameMessage
    GameOrError<G extends Game<Event>>
    Represents the union type of a game or an error, along with some helper getters to work with them
    GameProviders
    GameServer
    GameStateNotifier<E extends Event, G extends Game<E>>
    A StateNotifier that handles events for a particular game, delegating to the game's implementation for non generic events
    GameValue<G extends Game<Event>>
    GenericEvent
    A GenericEvent that is handled by the Generic server implementation rather than handling it differently in each game implementation
    GenericEventUndo
    GenericGame
    Represents a generic game, with common fields that can be manipulated by common GenericEvents
    IList<T>
    An immutable list. Note: The replace method is the equivalent of operator []= for the IList.
    IListConst<T>
    This is an IList which can be made constant. Note: Don't ever use it without the "const" keyword, because it will be unsafe.
    IListOf2<T>
    An immutable list of only 2 items.
    IListOf3<T>
    An immutable list of only 3 items.
    IListOf4<T>
    An immutable list of only 4 items.
    IMap<K, V>
    An immutable, unordered map.
    IMapConst<K, V>
    This is an IMap which can be made constant. Note: Don't ever use it without the "const" keyword, because it will be unsafe.
    IMapOfSets<K, V>
    An immutable, unordered, map of sets.
    IMapOfSetsConst<K, V>
    ImmutableCollection<C>
    IOGameClient
    The socket IO implementation of GameClient
    IOServer
    IOServerClient
    The socket IO implementation of ServerClient
    ISet<T>
    An immutable, ordered set. It can be configured to order by insertion order, or sort.
    ISetConst<T>
    This is an ISet which can be made constant. Note: Don't ever use it without the "const" keyword, because it will be unsafe.
    LastOrLoadingStateNotifier<T>
    ListMap<K, V>
    A ListMap is a mutable, fixed-sized, and ordered map.
    ListMapView<K, V>
    A ListMapView lets you view a regular map as if it was a ListMap. At the moment this class is for FIC's internal use only, since a lot of its methods will throw UnsupportedError.
    ListSet<T>
    A ListSet is, at the same time:
    ListSetView<T>
    LoadingFuture<T>
    Lobby
    LobbyNotifier
    LocalGame
    Keeps track of some metadata about a game for an OnDeviceClient game
    MapEntryEquality<E>
    This works for any object, not only map entries, but MapEntry gets special treatment. We consider two map-entries equal when their respective key and values are equal.
    ModifiableListFromIList<T>
    The ModifiableListFromIList is a safe, modifiable List that is built from an IList. The construction of the list is fast at first, since it makes no copies of the IList items, but just uses it directly.
    ModifiableMapFromIMap<K, V>
    The ModifiableMapFromIMap is a safe, modifiable Map that is built from an IMap. The construction of the map is fast at first, since it makes no copies of the IMap items, but just uses it directly.
    ModifiableSetFromISet<T>
    The ModifiableSetFromISet is a safe, modifiable Set that is built from an ISet. The construction of the set is fast at first, since it makes no copies of the ISet items, but just uses it directly.
    NoServerClient
    An on device implementation of ServerClient
    NoServerGameClient
    An implementation of a GameClient for a local game on device with no server connection
    Output<T>
    Meant to be used when you wish to save a value that's going to be tossed out of an immutable collection.
    Override
    An object used by ProviderContainer/ProviderScope to override the behavior of a provider/family for part of the application.
    Player
    Represents the basic details of a player in a game
    Provider<State>
    A provider that exposes a read-only value.
    ProviderBase<State>
    A base class for all providers.
    ProviderContainer
    An object that stores the state of the providers and allows overriding the behavior of a specific provider.
    ProviderElement<State>
    A provider that exposes a read-only value.
    ProviderElementBase<State>
    An internal class that handles the state of a provider.
    ProviderFamily<State, Arg>
    A class that allows building a Provider from an external parameter.
    ProviderListenable<State>
    A base class for all providers, used to consume a provider.
    ProviderObserver
    An object that listens to the changes of a ProviderContainer.
    ProviderOverride
    An object used by ProviderContainer to override the behavior of a provider for a part of the application.
    ProviderRef<State>
    An object used by providers to interact with other providers and the life-cycles of the application.
    ProviderSubscription<State>
    Represents the subscription to a provider
    Ref
    An object used by providers to interact with other providers and the life-cycles of the application.
    ReversedListView<T>
    Returns a List of the objects in this list in reverse order. Very efficient since it returns a view, which means if you change the original list this one will also change, and vice-versa.
    ServerClient
    A Client that can contact the server to manage games
    StateController<T>
    A StateNotifier that allows modifying its state from outside.
    StateNotifier<T>
    An observable class that stores a single immutable state.
    StateNotifierProvider<Notifier extends StateNotifier<State>, State>
    Creates a StateNotifier and expose its current state.
    StateNotifierProviderFamily<Notifier extends StateNotifier<State>, State, Arg>
    A class that allows building a StateNotifierProvider from an external parameter.
    StateNotifierProviderRef<Notifier extends StateNotifier<State>, State>
    An object used by providers to interact with other providers and the life-cycles of the application.
    StateProvider<State>
    A provider that expose a value which can be modified from outside.
    StateProviderElement<State>
    The ProviderElementBase for StateProvider
    StateProviderFamily<State, Arg>
    StateProviderRef<State>
    An object used by providers to interact with other providers and the life-cycles of the application.
    StreamProvider<State>
    Creates a stream and expose its latest event.
    StreamProviderFamily<State, Arg>
    A class that allows building a StreamProvider from an external parameter.
    StreamProviderRef<State>
    An object used by providers to interact with other providers and the life-cycles of the application.
    Tuple
    Dedicated Indexation Zip
    Tuple2<T1, T2>
    Resulting composition of multiple sources like indexes or other Iterables. Adapted from Tuple package
    UnmodifiableListFromIList<T>
    The UnmodifiableListFromIList is a relatively safe, unmodifiable List view that is built from an IList or another List. The construction of the UnmodifiableListFromIList is very fast, since it makes no copies of the given list items, but just uses it directly.
    UnmodifiableMapFromIMap<K, V>
    The UnmodifiableMapFromIMap is a relatively safe, unmodifiable Map that is built from an IMap or another Map. The construction of the UnmodifiableMapFromIMap is very fast, since it makes no copies of the given map items, but just uses it directly.
    UnmodifiableSetFromISet<T>
    The UnmodifiableSetFromISet is a relatively safe, unmodifiable Set view that is built from an ISet or another Set. The construction of the UnmodifiableSetFromISet is very fast, since it makes no copies of the given set items, but just uses it directly.

    Enums

    GameStatus
    Represents the current status of the game as seen by the client
    NameSet
    Represents a set of names that can be randomly assigned to players

    Mixins

    AlwaysAliveProviderListenable<State>
    A base class for all providers, used to consume a provider.
    FromIListMixin<T, I extends FromIListMixin<T, I>>
    This mixin implements all IList methods (without config (ConfigList)), plus operator [], but it does NOT implement Iterable nor IList.
    FromISetMixin<T, I extends FromISetMixin<T, I>>
    This mixin implements all ISet members (without config), but it does NOT implement Iterable nor ISet.
    FromIterableIListMixin<T>
    This mixin implements all Iterable methods, plus operator [], but it does NOT implement Iterable nor IList.
    FromIterableISetMixin<T>
    This mixin implements all Iterable methods, but it does NOT implement Iterable nor ISet.
    StateNotifierProviderOverrideMixin<Notifier extends StateNotifier<State>, State>
    Add overrideWithValue to AutoDisposeStateNotifierProvider

    Extensions

    AlwaysAliveAsyncProviderX on AlwaysAliveProviderBase<AsyncValue<State>>
    Adds future and stream to providers that emit an AsyncValue
    AsyncValueX on AsyncValue<T>
    An extension that adds methods like when to an AsyncValue.
    AutoDisposeAsyncProviderX on AutoDisposeProviderBase<AsyncValue<State>>
    Adds future and stream to autoDispose providers that emit an AsyncValue
    EventX on Event
    An extension to convert an Event to a GameEvent
    FicBooleanExtension on bool
    See also: compareObject, FicComparableExtension, FicComparatorExtension, sortBy, sortLike
    FicComparableExtension on Object?
    FicComparatorExtension on int
    The if0 extension lets you nest comparators. For example:
    FicIterableExtension on Iterable<T>
    See also: FicListExtension, FicSetExtension
    FicIterableExtensionTypeNullable on Iterable<T?>
    See also: FicListExtension, FicSetExtension
    FicIterableOfMapEntryExtension on Iterable<MapEntry<K, V>>
    FicIteratorExtension on Iterator<T>
    See also: FicIterableExtension
    FicListExtension on List<T>
    FicListExtensionNullable on List<T?>
    FicMapEntryExtension on MapEntry<K, V>
    FicMapExtension on Map<K, V>
    See also: FicMapOfSetsExtension
    FicMapIteratorExtension on Iterator<MapEntry<K, V>>
    See also: FicIterableExtension, FicIteratorExtension
    FicMapOfSetsExtension on Map<K, Set<V>>
    See also: FicMapExtension
    FicNumberExtension on T
    FicNumberExtensionNullable on T?
    FicObjectExtension on Object?
    FicSetExtension on Set<T>
    See also: FicListExtension
    FICZipExtension on Iterable<Tuple2<U, V>>
    GameMapExtensions on IMap<K, V>
    GameOrErrorGameX on Game<E>
    GameTypeOf on String
    GameX on Game<Event>
    Some extensions on Game to more easiliy get some of the GenericGame fields
    XAutoDisposeFamily on Family<State, Arg, FamilyProvider>
    An extension that adds overrideWithProvider to Family.
    XFamily on Family<State, Arg, FamilyProvider>
    An extension that adds overrideWithProvider to Family.

    Constants

    defaultGamePort → const int
    The default port
    IOClient → const String
    Location that corresponds to using an io-server for the backend
    OnDeviceClient → const String
    Location that corresponds to running the game on-device
    P1 → const PlayerID
    A default PlayerID for Player 1 in a two player game
    P2 → const PlayerID
    A default PlayerID for Player 2 in a two player game
    useCopy → const UseResult

    Properties

    defaultAddress Uri
    The default address to determine if the address has been set
    final
    homeDir String
    Gets the home path based on the operating system, should only be used in server contexts
    no setter
    nameSets Map<NameSet, List<PlayerName>>
    The sets of approved names for random assignment
    final
    onDeviceGameClient Provider<GameClient>
    final
    onDeviceGameServerClient Provider<ServerClient>
    final
    socketIOGameClient Provider<GameClient>
    final
    socketIOGameServerClient Provider<ServerClient>
    final

    Functions

    areImmutableCollectionsWithEqualItems(ImmutableCollection? c1, ImmutableCollection? c2) bool
    Will return true only if the collections are of the same type, and their items are equal by calling the collection's equalItems method. This may be slow for very large collection, since it compares each item, one by one. Note this will not compare the collection configuration.
    areSameImmutableCollection(ImmutableCollection? c1, ImmutableCollection? c2) bool
    While identical(collection1, collection2) will compare the collections by identity, areSameImmutableCollection(collection1, collection2) will compare them by type, and then by their internal state. Note this is practically as fast as identical, but will give less false negatives. So it is almost always recommended to use areSameImmutableCollection instead of identical.
    combineIterables<A, B, R>(Iterable<A> a, Iterable<B> b, R combine(A, B), {bool allowDifferentSizes = false}) Iterable<R>
    Combines iterables a and b into one, by applying the combine function. If allowDifferentSizes is true, it will stop as soon as one of the iterables has no more values. If allowDifferentSizes is false, it will throw an error if the iterables have different length.
    compareObject<T extends Object>(Object? a, Object? b, {bool nullsBefore = false}) int
    The compareObject comparator is similar to the natural comparator provided by Comparable objects in their Comparable.compareTo method, to sort objects in their "natural order". The difference here is that compareObject is also able to compare some objects which are not Comparable, such as bool, MapEntry, and nulls.
    generateGameID(List<String> avoidList) GameCode
    sortBy<T>(Predicate<T> test, {int then(T, T)?}) int Function(T, T)
    The sortBy function can be used to create a comparator to sort collections, comparing a and b such that:
    sortLike<T, E>(Iterable<E> order, {E mapper(T)?, int then(T, T)?}) int Function(T, T)
    The sortLike function can be used to create a comparator to sort collections, comparing a and b such that:

    Typedefs

    ClientType = String
    Create<T, R extends Ref> = T Function(R ref)
    A callback used by providers to create the value exposed.
    EQ<T, U> = bool Function(T item, U other)
    ErrorListener = void Function(Object error, StackTrace? stackTrace)
    A callback that can be passed to StateNotifier.onError.
    EventType = String
    FamilyCreate<T, R extends Ref, Arg> = T Function(R ref, Arg arg)
    A Create equivalent used by Family.
    GameAddress = Uri
    GameCode = String
    GameType = String
    Locator = T Function<T>()
    A function that allows obtaining other objects.
    Op<T> = T Function(T element)
    Operation of type that conserve the original type
    PlayerID = String
    PlayerName = String
    Predicate<T> = bool Function(T element)
    ProviderReference = Ref
    Alias for Ref
    Reader = T Function<T>(ProviderBase<T> provider)
    A function that reads the state of a provider.
    RemoveListener = void Function()
    A callback that can be used to remove a listener added with StateNotifier.addListener.
    SetupOverride = void Function({required ProviderBase origin, required ProviderBase override})
    An implementation detail for the override mechanism of providers

    Exceptions / Errors

    CircularDependencyError
    An error thrown when a call to Ref.read/Ref.watch leads to a provider depending on itself.
    DependencyNotFoundException<T>
    Thrown when tried to call LocatorMixin.read<T>(), but the T was not found.s
    ProviderException
    Encapulates an exception thrown while building a provider.
    StateNotifierListenerError
    An error thrown when tried to update the state of a StateNotifier, but at least of the listeners threw.