Asynchronous callback uploading one file; its result reaches the success callback and errors reach error handling.
typedef TxUploadAdapter = Future<Object?> Function(TxFile file, TxUploadContext context);import 'dart:typed_data';
import 'package:tecexpress/tecexpress.dart';
Future<void> example() async {
TxUploadAdapter adapter = (file, context) async {
context.cancellation.throwIfCancelled();
final size = await file.length();
context.onProgress(size, size);
return file.name;
};
print(await adapter(TxFile.fromData(Uint8List(0), name: 'empty.txt'), TxUploadContext(cancellation: TxCancellation(), onProgress: (loaded, total) {})));
}