t×tecexpressby TeKOcloud
DEv0.7.1
Files & maps / FLUTTER

TxFileUploader.

Interactive preview

Demo: Upload requests are consumed and immediately discarded. Nothing is stored.

File picker and upload queue with size/type checks, progress and retry from the beginning.

TxFileUploader

ParameterTypeDefaultMeaning
adapterTxUploadAdapter?nullUpload function for one file.
dataSourceObject?nullList, configuration or DataSource instance; takes precedence over items.
multipleboolfalseAllows multiple files.
maxFileSizeint?nullMaximum file size in bytes.
minFileSizeint0Minimum file size in bytes.
extensionsList<String>const []Allowed file extensions without a dot.
instantlyboolfalseStarts valid files immediately after selection.
disabledboolfalseDisables interaction.
onUploadedvoid Function(TxFile, Object?)?nullProvides the uploaded TxFile and adapter result.
onErrorvoid Function(TxFile, Object)?nullReports the file and error of a failed upload operation.
onChangedValueChanged<List<TxFile>>?nullCallback for changed; see the signature for arguments and return type.
dart
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';

Widget example() {
  // Demo endpoint: consumes the request without storing files. Maximum 1 MiB.
  final upload = txHttpUpload(TxHttpUploadConfig(url: Uri.base.resolve('/api/upload')));
  return TxFileUploader(adapter: upload, extensions: const ['txt'], maxFileSize: 1048576);
}