UMutedWordActorTarget class
Overview
This is an union object to improve safety and convenience of objects using Enum.
Enum provides a very powerful type for a specific group of data, but at the same time it means a loss of flexibility: values not defined in Enum are either completely ignored or an exception is thrown if parsing fails. This union object exists to solve that problem.
This union object handles the KnownValue
, a known enum value defined in Lexicon,
and the UnknownValue
, an unknown string value not defined in Lexicon. In other words,
it can handle unknown values while enjoying the type safety of Enum.
Usage
// use when syntax.
final value = object.when(
knownValue: (data) => data, // => KnownMutedWordActorTarget
unknownValue: (data) => data, // => String
);
// or simpler way.
if (object.isKnownValue) {
print(object.knownValue); // => KnownMutedWordActorTarget or null
} else if (object.isUnknownValue) {
print(object.unknownValue); // => String or null
}
- Implementers
- Available extensions
- Annotations
-
- @freezed
Constructors
- UMutedWordActorTarget.knownValue({required KnownMutedWordActorTarget data})
-
constfactory
- UMutedWordActorTarget.unknownValue({required String data})
-
constfactory
Properties
- data → Object
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isKnownValue → bool
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns true if this is known value, otherwise false.no setter - isNotKnownValue → bool
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns true if this is not known value, otherwise false.no setter - isNotUnknownValue → bool
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns true if this is not unknown value, otherwise false.no setter - isUnknownValue → bool
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns true if this is unknown value, otherwise false.no setter - knownValue → KnownMutedWordActorTarget
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns known value.no setter - knownValueOrNull → KnownMutedWordActorTarget?
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns known value if this data is known, otherwise null.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unknownValue → String
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns unknown value.no setter - unknownValueOrNull → String?
-
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns unknown value if this data is unknown, otherwise null.no setter
Methods
-
map<
TResult extends Object?> ({required TResult knownValue(UMutedWordActorTargetKnownValue value), required TResult unknownValue(UMutedWordActorTargetUnknownValue value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult? knownValue(UMutedWordActorTargetKnownValue value)?, TResult? unknownValue(UMutedWordActorTargetUnknownValue value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult knownValue(UMutedWordActorTargetKnownValue value)?, TResult unknownValue(UMutedWordActorTargetUnknownValue value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> ({TResult knownValue(KnownMutedWordActorTarget data)?, TResult unknownValue(String data)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → String -
Available on UMutedWordActorTarget, provided by the $UMutedWordActorTargetExtension extension
Returns string value. -
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> ({required TResult knownValue(KnownMutedWordActorTarget data), required TResult unknownValue(String data)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> ({TResult? knownValue(KnownMutedWordActorTarget data)?, TResult? unknownValue(String data)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited