INNER CODE UNIT · Dart

BackgroundUseCaseParams

ShadyBoukhary/flutter_clean_architecture · lib/src/background_usecase.dart:21

class BackgroundUseCaseParams<T> {
  T? params;
  SendPort port;
  BackgroundUseCaseParams(this.port, {this.params});
}

/// A specialized type of [UseCase] that executes on a different isolate.
/// The purpose is identical to [UseCase], except that this runs on a different isolate.
/// A [BackgroundUseCase] is useful when performing expensive operations that ideally
/// should not be performed on the main isolate.
///
/// The code that is to be run on a different isolate can be provided through a
/// static method of the usecase. Then, a reference of that method should be returned
/// by overriding the [buildUseCaseTask] as shown below. Input data for the isolate
/// is provided by inside the `params` variable in [BackgroundUseCaseParams], which is
/// passed to the static method of type [UseCaseTask].
///
/// Output data can be passed back to the main isolate through `port.send()` provided

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…