send method
dynamic
send(
- Future observable, {
- TaskStatusListener? listener,
- OnData? onData,
- OnError? onError,
Implementation
send(Future observable,
{TaskStatusListener? listener, OnData? onData, OnError? onError}) {
final ls = listener ?? EmptyListener();
ls.onStart();
observable.then(
(data) {
final canCall = () => true && onData != null;
if (canCall()) Timer.run(() => onData?.call(data));
},
onError: (e, s) {
List data = e.toString().split('::');
if (data.length != 3) {
return;
}
// errLog(e, s);
if (onError != null) {
Timer.run(
() => onError(data[1], int.parse(data[0].toString())),
);
} else if (e is AuthError) {
// clearLoginInfo();
// toLogin(context, err);
}
},
)..whenComplete(ls.onFinish);
}