game_scaffold library Null safety

Classes

AlwaysAliveProviderBase<Created, Listened>
A base class for providers that never disposes themselves. [...]
AsyncData<T>
AsyncError<T>
AsyncLoading<T>
AsyncValue<T>
An utility for safely manipulating asynchronous data. [...]
AutoDisposeFutureProvider<T>
A provider that asynchronously creates a single value. [...]
AutoDisposeFutureProviderFamily<T, A>
A class that allows building a FutureProvider from an external parameter.
AutoDisposeProvider<T>
A provider that exposes a read-only value. [...]
AutoDisposeProviderBase<Created, Listened>
A base class for providers that destroy their state when no-longer listened. [...]
AutoDisposeProviderElement<Created, Listened>
The ProviderElement of an AutoDisposeProviderBase.
AutoDisposeProviderFamily<T, A>
A class that allows building a Provider from an external parameter.
AutoDisposeProviderReference
A ProviderReference for providers that are automatically destroyed when no-longer used. [...]
AutoDisposeStateNotifierProvider<Notifier extends StateNotifier<Value>, Value>
Creates a StateNotifier and expose its current state. [...]
AutoDisposeStateNotifierProviderFamily<Notifier extends StateNotifier<Value>, Value, Param>
A class that allows building a StateNotifierProvider from an external parameter.
AutoDisposeStateProvider<T>
A provider that expose a value which can be modified from outside. [...]
AutoDisposeStateProviderFamily<T, A>
A class that allows building a StateProvider from an external parameter.
AutoDisposeStreamProvider<T>
Creates a stream and expose its latest event. [...]
AutoDisposeStreamProviderFamily<T, A>
A class that allows building a StreamProvider from an external parameter.
BackendGameReader
BackendProvider
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<Created, Listened, Param, Ref extends ProviderReference, P extends RootProvider<Created, Listened>>
    A base class for all *Family variants of providers.
    FutureProvider<T>
    A provider that asynchronously creates a single value. [...]
    FutureProviderFamily<T, A>
    A class that allows building a FutureProvider from an external parameter.
    Game<E extends Event>
    Abstract class that all games must inherit from
    GameClient
    A client for a particular game identified by gameCode
    GameConfig
    Some general config parameters for a game of gameType [...]
    GameConverter<T extends Game<Event>>
    GameError<T 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
    GameHookWidget
    GameInfo
    An object to provide info about a particular game to the client [...]
    GameMessage
    GameNavigator
    GameOrError<T extends Game<Event>>
    Represents the union type of a game or an error, along with some helper getters to work with them
    GameProvider
    Provides an encapsulation of many providers without having to have each of them be a family provider.
    GameReader
    GameServerClient
    The GameServerClient interface
    GameStateNotifier<E extends Event, T extends Game<E>>
    A StateNotifier that handles events for a particular game, delegating to the game's implementation for non generic events
    GameValue<T extends Game<Event>>
    GenericEvent
    A GenericEvent that is handled by the Generic server implementation rather than handling it differently in each game implementation
    GenericEventStart
    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 3 items.
    IMap<K, V>
    An immutable, unordered map.
    IMapOfSets<K, V>
    An immutable, unordered, map of sets.
    ImmutableCollection<C>
    InternalsForTestingPurposesIList
    Don't use this class.
    InternalsForTestingPurposesIMap
    Don't use this class.
    InternalsForTestingPurposesISet
    Don't use this class.
    IOGameClient
    The socket IO implementation of GameClient
    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. [...]
    ISetImpl<T>
    L<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>
    M<K, V>
    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<T>
    A provider that exposes a read-only value. [...]
    ProviderBase<Created, Listened>
    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<Created, Listened>
    An internal class that handles the state of a provider. [...]
    ProviderFamily<T, A>
    A class that allows building a Provider from an external parameter.
    ProviderListenable<Listened>
    A base class for all providers, used to consume a provider. [...]
    ProviderObserver
    An object that listens to the changes of a ProviderContainer. [...]
    ProviderReference
    An object used by providers to interact with other providers and the life-cycles of the application. [...]
    ProviderSubscription<Listened>
    An object that allows watching the state of a provider. [...]
    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. [...]
    RootProvider<Created, Listened>
    A base class for non-scoped providers. [...]
    S<T>
    ScopedProvider<Listened>
    A provider that may behave differently for a specific part of the application. [...]
    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<Value>, Value>
    Creates a StateNotifier and expose its current state. [...]
    StateNotifierProviderFamily<Notifier extends StateNotifier<Value>, Value, Param>
    A class that allows building a StateNotifierProvider from an external parameter.
    StateProvider<T>
    A provider that expose a value which can be modified from outside. [...]
    StateProviderFamily<T, A>
    A class that allows building a StateProvider from an external parameter.
    StreamProvider<T>
    Creates a stream and expose its latest event. [...]
    StreamProviderFamily<T, A>
    A class that allows building a StreamProvider from an external parameter.
    SupabaseGameClient
    SupabaseServerClient
    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. [...]

    Mixins

    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. [...]

    Extensions

    AutoDisposeStateFamilyX
    Overrides overrideWithProvider for StateProvider.autoDispose.family.
    BackendReader
    BackendReaderX
    BuildContextGameScaffoldX
    EventX
    An extension to convert an Event to a GameEvent
    FamilyX
    Implements overrideWithProvider for families. [...]
    FicBooleanExtension
    See also: compareObject, FicComparableExtension, FicComparatorExtension, sortBy, sortLike
    FicComparableExtension
    FicComparatorExtension
    The if0 extension lets you nest comparators. For example: [...]
    FicIterableExtension
    See also: FicListExtension, FicSetExtension
    FicIterableExtensionTypeNullable
    See also: FicListExtension, FicSetExtension
    FicIterableOfMapEntryExtension
    FicIteratorExtension
    See also: FicIterableExtension
    FicListExtension
    FicListExtensionNullable
    FicMapEntryExtension
    FicMapExtension
    See also: FicMapOfSetsExtension
    FicMapIteratorExtension
    See also: FicIterableExtension, FicIteratorExtension
    FicMapOfSetsExtension
    See also: FicMapExtension
    FicNumberExtension
    FicNumberExtensionNullable
    FicObjectExtension
    FicSetExtension
    See also: FicListExtension
    FICZipExtension
    GameMapExtensions
    GameOrErrorGameX
    GameProviderHooksX
    GameReaderGameX
    GameReaderX
    GameTypeOf
    GameX
    Some extensions on Game to more easiliy get some of the GenericGame fields
    PlayerXName
    ReaderGameX
    StateFamilyX
    Overrides overrideWithProvider for StateProvider.family.

    Constants

    defaultAddress → const String
    The default address to determine if the address has been set
    'your game server ip'
    defaultGamePort → const int
    The default port that is used for Game Clients
    45912
    IOServerLocation → const String
    Location that corresponds to using an io-server for the backend
    'io-server'
    OnDeviceLocation → const String
    Location that corresponds to running the game on-device
    'on-device'
    P1 → const PlayerID
    A default PlayerID for Player 1 in a two player game
    '0'
    P2 → const PlayerID
    A default PlayerID for Player 2 in a two player game
    '1'
    SupabaseLocation → const String
    'supabase-server'

    Properties

    agentBackendGame Provider<BackendProvider>
    final
    backendGameCodesProvider StateProvider<IList<GameCode>>
    final
    backendGamesProvider ProviderFamily<BackendProvider, GameCode>
    final
    gameLocationProvider StateProvider<ServerLocation>
    The provider that controls the GameClient and ServerClient implementation to use
    final
    homeDir String
    Gets the home path based on the operating system, should only be used in server contexts
    read-only
    nameSets Map<NameSet, List<PlayerName>>
    The sets of approved names for random assignment
    final
    playerGameProvider ProviderFamily<GameProvider, PlayerID>
    Provides an encapsulation of many providers related to a Game without having to have each of them be a family provider.
    final
    playerIDProvider ScopedProvider<PlayerID>
    Provides the player id for a particular section of the widget tree [...]
    final
    playerIDsProvider StateProvider<IList<PlayerID>>
    final
    selectedAddress StateProvider<GameAddress>
    The provider that controls which game server address to connect to
    final
    singleConfigProvider StateProvider<GameConfig>
    Allows one config to write all players' configs
    final
    supabaseProvider Provider<SupabaseClient>
    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
    registerIOClients() → void
    Registers IO Client implementations
    registerOnDeviceClients() → void
    Registers clients for on device game event handling
    registerSupabaseServerClients() → void
    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: [...]
    useAddress(String id) String
    Setup parameters
    useCurrentGameInfo(GameProvider g) GameInfo?
    Server information
    useGameClient(GameProvider g) GameServerClient
    Client
    useGameCode(GameProvider g) String
    useGameConfig(GameProvider g) GameConfig
    Game setup information
    useGameError(GameProvider g) GameError<Game<Event>>?
    useGameInfos(GameProvider g) Future<IList<GameInfo>>
    useGameName(GameProvider g) String
    useGameProvider(String id) GameProvider
    useGameState(GameProvider g) Game<Event>?
    Game information
    useGameStatus(GameProvider g) GameStatus
    useGameTurn(GameProvider g) bool
    useLobbyInfo(GameProvider g) GameInfo?
    usePlayerID() String
    usePlayerName(GameProvider g) String?

    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

    Typedefs

    Create<T, Ref extends ProviderReference> = T Function(Ref 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
    GameAddress = String
    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)
    /////////////////////////////////////////////////////////////////////////////////////////////////
    Reader = T Function<T>(RootProvider<Object?, 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. [...]
    ScopedCreate<T> = T Function(ScopedReader watch)
    The function that ScopedProviders uses to create their state.
    ScopedReader = T Function<T>(ProviderBase<Object?, T> provider)
    A function that can both read a ScopedProvider, normal providers and a myProvider.select(..)
    ServerLocation = String

    Exceptions / Errors

    CircularDependencyError
    An error thrown when a call to ProviderReference.read/ProviderReference.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.