HostActionResult class abstract

Standard result envelope returned by the host bridge after handling an action.

requestId and action allow correlation with the original request. errorCode is only expected on failures and should use a stable contract value whenever the failure maps to a known platform condition.

Available extensions
Annotations
  • @freezed

Constructors

HostActionResult({String? requestId, @JsonKey.new(name: 'action') String? actionName, required HostActionStatus status, String? message, String? errorCode, @Default.new(<String, dynamic>{}) Map<String, dynamic> data})
const
factory
HostActionResult.cancelled({String? requestId, String? actionName, String? message, Map<String, dynamic> data = const <String, dynamic>{}})
factory
HostActionResult.failed({String? requestId, String? actionName, String? message, String? errorCode, Map<String, dynamic> data = const <String, dynamic>{}})
factory
HostActionResult.fromJson(Map<String, dynamic> json)
factory
HostActionResult.success({String? requestId, String? actionName, String? message, Map<String, dynamic> data = const <String, dynamic>{}})
factory

Properties

actionName String?
no setterinherited
copyWith → $HostActionResultCopyWith<HostActionResult>
Create a copy of HostActionResult with the given fields replaced by the non-null parameter values.
no setterinherited
data Map<String, dynamic>
no setterinherited
errorCode String?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isCancelled bool

Available on HostActionResult, provided by the HostActionResultX extension

Whether the user or host cancelled the operation without success.
no setter
isFailure bool

Available on HostActionResult, provided by the HostActionResultX extension

Whether the operation failed.
no setter
isSuccess bool

Available on HostActionResult, provided by the HostActionResultX extension

Whether the host reports successful completion.
no setter
message String?
no setterinherited
requestId String?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status HostActionStatus
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_HostActionResult value)) → TResult

Available on HostActionResult, provided by the HostActionResultPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_HostActionResult value)?) → TResult?

Available on HostActionResult, provided by the HostActionResultPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_HostActionResult value)?, {required TResult orElse()}) → TResult

Available on HostActionResult, provided by the HostActionResultPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String? requestId, String? actionName, HostActionStatus status, String? message, String? errorCode, Map<String, dynamic> data)?, {required TResult orElse()}) → TResult

Available on HostActionResult, provided by the HostActionResultPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes this HostActionResult to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String? requestId, String? actionName, HostActionStatus status, String? message, String? errorCode, Map<String, dynamic> data)) → TResult

Available on HostActionResult, provided by the HostActionResultPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String? requestId, String? actionName, HostActionStatus status, String? message, String? errorCode, Map<String, dynamic> data)?) → TResult?

Available on HostActionResult, provided by the HostActionResultPatterns extension

A variant of when that fallback to returning null

Operators

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