AttachmentUploadState class sealed

Represents the upload state of an attachment.

This sealed class provides a type-safe way to represent the different states an attachment can be in during the upload process. Each state provides relevant information for that stage of the upload.

Example usage:

switch (uploadState) {
  case UploadStatePreparing():
    // Show preparing indicator
  case UploadStateInProgress(:final uploaded, :final total):
    // Show progress: uploaded/total
  case UploadStateSuccess():
    // Show success state
  case UploadStateFailed(:final error):
    // Show error: error.toString()
}

Constructors

AttachmentUploadState.failed({required Object error, StackTrace? stackTrace})
Creates a failed state with error information.
const
factory
AttachmentUploadState.inProgress({required double progress})
Creates an in-progress state with upload progress information.
const
factory
AttachmentUploadState.preparing()
Creates a preparing state indicating upload preparation.
const
factory
AttachmentUploadState.success()
Creates a success state indicating successful upload completion.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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