We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When files upload to server OnComplete event not invoke but server saved the file and return download link
this is my code implementation
import 'package:tus_client_dart/tus_client_dart.dart'; Future<void> uploadFile( {required XFile file, Function(TusClient client)? onComplete, Function(double)? onProgress}) async { try { final completer = Completer<void>(); final token = await login(); if (token.isNotEmpty) { final uri = Uri.parse('${Links.tusBaseUrl}/${Links.tusUrl}'); //? Create file store final tempDir = await getTemporaryDirectory(); final tempDirectory = Directory('${tempDir.path}/${file.name}_uploads'); if (!tempDirectory.existsSync()) { tempDirectory.createSync(recursive: true); } final client = TusClient( file, store: TusFileStore(tempDirectory), ); await client.upload( uri: uri, measureUploadSpeed: true, headers: { TusClientVariables.authToken: TusClientVariables.authTokenVal(token), }, onStart: (client, duration) {}, onProgress: (value, duration) async { if (onProgress != null) onProgress(value); if (value == 100) { if (onComplete != null) onComplete(client); completer.complete(); return; } }, onComplete: () { print("Completed!"); tempDirectory.deleteSync(recursive: true); }, ); return; } } catch (e) { print(e); return; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
OnComplete not invoke
this is my code implementation
The text was updated successfully, but these errors were encountered: