showLoading static method

void showLoading(
  1. String message, {
  2. bool useEarth = true,
})

Show Loading Spinner (Defaults to Earth 🌍)

Implementation

static void showLoading(String message, {bool useEarth = true}) {
  final frames = useEarth ? earthFrames : spinnerFrames;
  int i = 0;

  // Ensure no previous loader is running
  stopLoading();

  _loadingTimer = Timer.periodic(Duration(milliseconds: 200), (timer) {
    stdout.write('\r$message ${frames[i % frames.length]}');
    i++;
  });
}