artificial_delay 1.0.0 copy "artificial_delay: ^1.0.0" to clipboard
artificial_delay: ^1.0.0 copied to clipboard

outdated

A dart package to simulate artificial delays from volatile data providers.

example/artificial_delay_example.dart

import 'package:artificial_delay/artificial_delay.dart';

final artificialDelay = ArtificialDelay(
  minDelay: Duration(milliseconds: 100),
  maxDelay: Duration(milliseconds: 1000),
);

Future<List<int>> getIntsFromServer() async {
  await artificialDelay.trigger().then((value) => print('Took: $value ms'));
  return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]..shuffle();
}

Future<void> main() async {
  print('Fetching list of ints from server...');
  getIntsFromServer().then((value) => print('Received: $value'));
}
0
likes
0
points
23
downloads

Publisher

verified publishertytydraco.xyz

Weekly Downloads

A dart package to simulate artificial delays from volatile data providers.

Repository

License

unknown (license)

More

Packages that depend on artificial_delay