loadWithTask static method
Future<void>
loadWithTask({
- required String task,
- required Future process(),
- ConsoleLoader? loader,
- ConsoleColor? loaderColor,
- Duration? loaderSpeed,
- LoaderPosition? loaderPosition,
- String? loaderSuccessReplacement,
- ConsoleLoaderBase? customLoader,
Supply a task and a process future for that task, and show a beautiful loader till the task is finished. You can also customize a replacement output when it's done.
Implementation
static Future<void> loadWithTask({
required String task,
required Future Function() process,
//
ConsoleLoader? loader,
ConsoleColor? loaderColor,
Duration? loaderSpeed,
LoaderPosition? loaderPosition,
String? loaderSuccessReplacement,
//
ConsoleLoaderBase? customLoader,
}) async =>
await loadWithTaskImpl(
task: task,
process: process,
loader: loader ?? ConsoleLoader.spinner,
loaderColor: loaderColor ?? ConsoleColor.cyan,
loaderSpeed: loaderSpeed ?? const Duration(milliseconds: 100),
loaderPosition: loaderPosition ?? LoaderPosition.before,
loaderSuccessReplacement:
loaderSuccessReplacement ?? '✓'.withColor(ConsoleColor.green),
customLoader: customLoader,
);