ProgressCallback typedef

ProgressCallback = void Function(int count, int total)

author:ZhengZaiHong email:1096877329@qq.com date:2026-05-20 13:58 describe: Really requesting an adapter for the network Progress callback function type for file upload/download operations.

The callback receives two parameters:

  • count: Number of bytes transferred so far
  • total: Total number of bytes to transfer

Example:

onProgress: (count, total) {
  final percentage = (count / total * 100).toStringAsFixed(1);
  print('Progress: $percentage%');
}

Implementation

/// Progress callback function type for file upload/download operations.
///
/// The callback receives two parameters:
/// - [count]: Number of bytes transferred so far
/// - [total]: Total number of bytes to transfer
///
/// Example:
/// ```dart
/// onProgress: (count, total) {
///   final percentage = (count / total * 100).toStringAsFixed(1);
///   print('Progress: $percentage%');
/// }
/// ```
typedef ProgressCallback = void Function(int count, int total);