gg_status_printer 1.0.8 gg_status_printer: ^1.0.8 copied to clipboard
Prints progress, success, and error messages with Unicode icons for async operations.
example/gg_status_printer_example.dart
#!/usr/bin/env dart
// @license
// Copyright (c) 2019 - 2024 Dr. Gabriel Gatzsche. All Rights Reserved.
//
// Use of this source code is governed by terms that can be
// found in the LICENSE file in the root of this package.
import 'package:gg_status_printer/gg_status_printer.dart';
void main() async {
print('\nPrint all states one the same line');
// ⌛️✅ Loading data
await GgStatusPrinter<void>(
message: 'Loading data',
useCarriageReturn: true,
).run(() => Future<void>.delayed(const Duration(seconds: 1)));
print('\nPrint all states on different lines');
// ⌛️ Loading data
// ✅ Loading data
await GgStatusPrinter<void>(
message: 'Loading data',
useCarriageReturn: false,
).run(() => Future<void>.delayed(const Duration(seconds: 1)));
print('\nPrint fail states');
// ⌛️ Loading data
// ❌ Loading data
try {
await GgStatusPrinter<void>(
message: 'Loading data',
useCarriageReturn: false,
).run(
() => Future<void>.delayed(const Duration(seconds: 1))
.then((_) => throw Exception('Failed')),
);
} catch (_) {}
}