The Dart SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Dart - bucket.file.getUploadUrl()
Create an upload URL for a file within a bucket.
import 'package:nitric_sdk/nitric.dart';
final assets = Nitric.bucket("assets").allow([
BucketPermission.write,
]);
final photo = assets.file("images/logo.png");
// Create a write-only url reference for uploading
final uploadUrl = await logo.getUploadUrl(expiry: 300);
Parameters
- Name
expiry
- Optional
- Optional
- Type
- int
- Description
Seconds until link expiry. Defaults to
600
, Maximum of604800
(7 days).
Examples
Create a temporary file upload link for a user
import 'package:nitric_sdk/nitric.dart';
final assets = Nitric.bucket("uploads").allow([
BucketPermission.write,
]);
final photo = assets.file("images/logo.png");
// Create a write-only url reference for uploading
final uploadUrl = await logo.getUploadUrl(expiry: 300);