t×tecexpressby TeKOcloud
DEv0.7.1
API & types / FLUTTER

TxFileProvider.

Asynchronous contract for directory listings and file operations.

list is required. Vue offers optional methods; Dart implementations declare capabilities and override matching methods. Unimplemented Dart operations throw UnsupportedError. list/upload support cooperative cancellation. createDirectory/upload return an entry; rename/copy/move/remove return no value; download returns Blob (Vue) or Uint8List (Dart).

Member / type / returnMeaning
Set<String> get capabilitiesSupported file operations; controls visible actions.
Future<List<TxFileEntry>> list(String? parentId, {TxCancellation? cancellation})Returns entries in the parent directory; null reads the root.
Future<TxFileEntry> createDirectory(String? parentId, String name)Creates a directory with a valid name unique within its parent.
Future<void> rename(String id, String name)Renames a file or directory; preserves its ID and parent.
Future<void> copy(String id, String? target)Recursively copies an entry to the target directory, assigning new IDs.
Future<void> move(String id, String? target)Moves an entry to the target directory; cycles are rejected.
Future<void> remove(String id)Removes the record or recursively removes a file/directory tree.
Future<TxFileEntry> upload(String? parentId, TxFile file, {TxCancellation? cancellation})Uploads a file to the specified directory and returns its new entry.
Future<Uint8List> download(String id)Returns file contents; downloading a directory fails.
dart
import 'package:tecexpress/tecexpress.dart';

Future<void> example() async {
  TxFileProvider provider = TxMemoryFileProvider();
  print(provider.capabilities);
  print(await provider.list(null));
}