FlogHttpUpload class

Sube el archivo exportado (.flowx) a un endpoint HTTP como multipart/form-data. Una instancia es callable, así que se puede pasar directo a FlogFlow.instance.enableAutoUpload(upload: FlogHttpUpload(...)).

final uploader = FlogHttpUpload(
  url: 'https://api.tuservidor.com/flows',
  headers: {'Authorization': 'Bearer $token'},
  fields: {'app': 'cafe_rio'},
);

Constructors

FlogHttpUpload({required String url, Map<String, String> headers = const {}, Map<String, dynamic> fields = const {}, String fileField = 'file', String method = 'POST', void onError(Object error, {int? statusCode})?, Dio? dio})

Properties

fields Map<String, dynamic>
Campos extra del form (ej. {'app': 'cafe_rio'}).
final
fileField String
Nombre del campo del archivo en el multipart.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Cabeceras (ej. autenticación).
final
method String
final
onError → void Function(Object error, {int? statusCode})?
Hook opcional: se llama cuando la subida falla, con el error y (si lo hubo) el status HTTP. En debug, el fallo además se imprime en consola.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
URL del endpoint que recibe el archivo.
final

Methods

call(File file) Future<bool>
Realiza la subida. Devuelve true si el status es 2xx.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited