GameOrError<G extends Game<Event>> class

Represents the union type of a game or an error, along with some helper getters to work with them

Implementers
Annotations
  • @freezed

Constructors

GameOrError.error(String message, PlayerID person)
Represets an error
const
factory
GameOrError.fromJson(Map<String, dynamic> json)
factory
GameOrError.game(@GameConverter<Game<Event>>() G game)
Represents a game
const
factory

Properties

error GameError<Game<Event>>?
Returns the error or null
no setter
errorString String
Returns the error message or 'No Error'
no setter
hashCode int
The hash code for this object.
no setterinherited
isError bool
Returns whether this instance is an error
no setter
isGame bool
Returns whether this instance is a game
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → G?
Returns the game value or null
no setter

Methods

map<TResult extends Object?>({required TResult game(GameValue<Game<Event>> value), required TResult error(GameError<Game<Event>> value)}) → TResult
inherited
mapOrNull<TResult extends Object?>({TResult game(GameValue<Game<Event>> value)?, TResult error(GameError<Game<Event>> value)?}) → TResult?
inherited
maybeMap<TResult extends Object?>({TResult game(GameValue<Game<Event>> value)?, TResult error(GameError<Game<Event>> value)?, required TResult orElse()}) → TResult
inherited
maybeWhen<TResult extends Object?>({TResult game(Game<Event> game)?, TResult error(String message, String person)?, required TResult orElse()}) → TResult
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult game(Game<Event> game), required TResult error(String message, String person)}) → TResult
inherited
whenOrNull<TResult extends Object?>({TResult game(Game<Event> game)?, TResult error(String message, String person)?}) → TResult?
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited