file_uploader_socket_interfaces 1.3.1 copy "file_uploader_socket_interfaces: ^1.3.1" to clipboard
file_uploader_socket_interfaces: ^1.3.1 copied to clipboard

common interfaces for plugins that handle file upload via socket

example/lib/example.dart

import 'package:en_file_uploader/en_file_uploader.dart';
import 'package:file_uploader_socket_interfaces/file_uploader_socket_interfaces.dart';
import 'package:file_uploader_utils/file_uploader_utils.dart' as utils;

main() async {
  final file = utils.createIoFile();

  final restorableHandler = ImplSocketFileHandler(
    path: 'fake',
    file: XFile(file.path),
  );

  final controller = FileUploadController(
    restorableHandler,
    logger: utils.PrintLogger(),
  );
  await controller.upload();

  print("done!");
}

class ImplSocketFileHandler extends SocketFileHandler<Object> {
  ImplSocketFileHandler({
    required super.file,
    required super.path,
    super.body,
    super.fileKey,
    super.fileParser,
    super.headers,
    super.method,
  });

  @override
  Future<void> upload({ProgressCallback? onProgress}) {
    return Future.delayed(const Duration(seconds: 1));
  }
}
0
likes
160
points
124
downloads

Publisher

verified publishermattiapispisa.it

Weekly Downloads

common interfaces for plugins that handle file upload via socket

Homepage
Repository (GitHub)
View/report issues

Topics

#socket #file #upload #chunks #retry

Documentation

API reference

License

MIT (license)

Dependencies

en_file_uploader

More

Packages that depend on file_uploader_socket_interfaces