run_small_dropbox

Creator: coderz1093

Last updated:

0 purchases

run_small_dropbox Image
run_small_dropbox Images
Add to Cart

Description:

run small dropbox

Run Small Dropbox Package #
A Dart SDK that simplifies interaction with the Dropbox API.
This SDK provides convenient abstractions and methods for common operations when working with Dropbox, such as copying files, creating folders, downloading files, and more.
The goal is to accelerate the integration of Dropbox functionality into the Dart and Flutter apps.
The SDK is designed to be easy to use and follows a similar structure to other popular SDKs like Firebase, making it easy for familiar developers to seamlessly integrate Dropbox functionality into their apps.
Update (3.1.0) #
In some cases, you may have file or folder names with non-ASCII characters. The escapeNonAscii (released in version 3.1.0) function was designed to handle situations where you may encounter file or folder names containing non-ASCII characters when interacting with the Dropbox API. The Dropbox API requires these characters to be handled appropriately to ensure smooth communication.
void main() {
var escapedString = escapeNonAscii('Café');
print('Escaped String: $escapedString'); // >>> Escaped String: Caf\u00e9
}
copied to clipboard

escapeNonAscii is a built-in function of Run Small Dropbox, you don't need to import or define it explicitly.

Getting Started #
To use this package, add run_small_dropbox as a dependency in your pubspec.yaml file. For example:
dependencies:
run_small_dropbox: ^3.0.2
copied to clipboard
Features #


File Operations: Copy, move, delete, and manage files and folders.


Batch Operations: Perform multiple file operations in a single batch.


Folder Creation: Create folders individually or in batches.


Download and Upload Files: Download files, download folders as ZIP, upload files, and more.


Metadata Retrieval: Retrieve metadata for files and folders.


File and Folder Search: Search for files and folders.


Paper Operations: Create and update Paper documents.


Usage #
You need to get a DropboxApp instance to be able to use Dropbox modules, you can do it like this:

final app = Dropbox.initializeApp('YOUR-ACCESS-TOKEN');

copied to clipboard

NOTE: "Modules" are parts of the SDK that you can access separately.
They would basically be what Firebase Storage, Firebase Core, and
Firebase Authentication are to the Firebase SDK.

So far we only have a single “Module”, DropboxFile.
All “Modules” depend on a DropboxApp object to function.

I won't put comments over the examples, you can use your IDE to get an idea of what each method does. All methods have rich documentation.

Copy File #

Feature<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.copyFile(relocationPath: RelocationPath(fromPath: '/Documents/favicon2_.png', toPath: '/Desktop/favicon2_.png'));
}

copied to clipboard
In the examples, you will probably notice that in some cases, the beginning of folders begins with a forward slash "/". What happens is that the Dropbox API returns an exception if it doesn't find this bar at the beginning. But Run Small Dropbox gives you the freedom to add it or not, thanks to rPath:
void main(){
String path1 = rPath('/MyPathInDropbox'); // With the forward slash "/"
String path2 = rPath('MyPathInDropbox'); // Without the slash "/".

print("output 1: $path1"); // >>> output 1: /MyPathInDropbox
print("output 2: $path2"); // >>> output 2: /MyPathInDropbox
}
copied to clipboard

rPath is an internal function of Run Small Dropbox, you do not need to import it or define it explicitly. When using a method with requires a path, you can choose to pass or not pass without the "/" slash.
dropboxFile.copyFile(FolderWithoutSlash/file.txt);

Copy File Batch #

Feature<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

List<RelocationPath> entries = [
RelocationPath(fromPath: '/Documents/drop_up.txt', toPath: '/Desktop/drop_up.txt'),
RelocationPath(fromPath: '/Documents/uploadtestfile.txt', toPath: '/Desktop/uploadtestfile.txt'),
];

var data = await dropboxFile.copyBatch(entries: entries);
}

copied to clipboard
Copy Batch Check #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);
var data = await dropboxFile.copyBatchCheck('dbjid:AAAeL_0EYiPPSNJabLJLqdAYWSzDBghRkbYWoV2SDx9Lbg7rr9PG8_Igr_7_irFzWvaVNTeWU7r8lab3cJ9sUOsA');

}

copied to clipboard
Get Copy Reference #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);
var data = await dropboxFile.getCopyReference('/Documents/orders.json');
}

copied to clipboard
Save Copy Reference #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);
String copyReference = 'AAAAAlDqCCBkYTZldjZoa3ZiOW0', path = '/Documents/ref/orders.json';

var data = await dropboxFile.saveCopyReference(copyReference, path);
}

copied to clipboard
Create Folder #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.createFolder('Downloads', autorename: true);
}

copied to clipboard
Create Folder Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.createFolderBatch(
['/Lib','Bin'],
autorename: false,
forceAsync: true,
);

}

copied to clipboard
Check Create Folder Batch Job Status #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

// For use this method, the flag forceAsync in createFolderBatch must be true
String asyncJobId = 'dbjid:AACIUTFyJ9SsVq7tFezji8rK-sO4GdpJ2wcn5hOUwsEw71d7hfa2aw_r9SCyiE9rxFqkwvIXmiNo5_KLTY8_LezA';

var data = await dropboxFile.checkCreateFolderBatchJobStatus(asyncJobId);
}

copied to clipboard
Delete File or Folder #

Future<void> method() async {
// Get DropboxFile Instance

DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.deleteFileOrFolder('/Lib');
}

copied to clipboard
Delete Files Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.deleteFilesBatch([
DeleteArg(path: 'Downloads (1)'),
DeleteArg(path: 'Downloads (2)'),
],
);

}

copied to clipboard
Delete Batch Check #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

String asyncJobId = 'dbjid:AABWTKVCz9BVnnCDelfli-hJO8ve91g7lszKeV7WmycG5kRb5F1X6kTjhYJDTekMK6IDRHZXV7R3UBY417cseFZd';

var data = await dropboxFile.deleteBatchCheck(asyncJobId);

}

copied to clipboard
Download File #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.downloadFile('/Documents/orders.json');
if (data['success']) {
var file = File('Me/Path/file.json');
await file.writeAsBytes(utf8.encode(data['result']));
}
}

copied to clipboard
Download Folder as Zip #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.downloadFolderAsZip('/Documents');

if (data['success']) {
var file = File('Me/Path/file.zip');

await file.writeAsBytes(utf8.encode(data['result']));
}
}

copied to clipboard
Export File #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.exportFile('/Documents/Prime Factorization.xlsx');
}

copied to clipboard
Get File Lock Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getFileLockBatch([]);
}

copied to clipboard
Get Metadata #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getMetadata('Desktop/orders.json');
}

copied to clipboard
Get Preview #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getPreview('/Documents/mitologiagrega.docx');
}

copied to clipboard
Get Temporary Link #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getTemporaryLink('/Documents/drop_up.txt');
}

copied to clipboard
Get Temporary Upload Link #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);
var data = await dropboxFile.getTemporaryUploadLink('/Documents/favicon2_.png');
}

copied to clipboard
Get Thumbnail V2 #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);
var data = await dropboxFile.getThumbnailV2('/Documents/favicon2_.png');

if (data['success']) {
var file = File('/Me/Desktop/favicon2_.jpeg');
await file.writeAsBytes(utf8.encode(data['result']));
}
}

copied to clipboard
Get Thumbnail Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getThumbnailBatch(['/Documents/favicon2_.png', '/Documents/favicon2_.png']);
}

copied to clipboard
List Folder #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.listFolder('/Documents');
}

copied to clipboard
List Folder Continue #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

String cursor = 'AAE78DDMQjfST3HwI';

var data = await dropboxFile.listFolderContinue(cursor);
}

copied to clipboard
List Folder Get Latest Cursor #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.listFolderGetLatestCursor('/Documents');
}

copied to clipboard
List Folder Longpoll #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

String cursor = 'AAGvWI9NjRfdjJwFCJdlQKIbRNn';
int timeout = 30;
var data = await dropboxFile.listFolderLongpoll(cursor, timeout: timeout);
}

copied to clipboard
List Revisions #

Future<void> method() async {

// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.listRevisions('/Documents/mitologiagrega.docx');
}

copied to clipboard
Lock File Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.lockFileBatch(['/Desktop/orders.json']);
}

copied to clipboard
Move V2 #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.moveV2(RelocationPath(fromPath: '/Documents/users.json', toPath: '/Desktop/users.json'));
}

copied to clipboard
Move Batch V2 #

Future<void> method() async {

// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.moveBatchV2([
RelocationPath(fromPath: '/Documents/users.json', toPath: '/Desktop/users.json'),
RelocationPath(fromPath: '/Documents/main.dart', toPath: '/Desktop/main.dart'),
],
);
}

copied to clipboard
Move Batch Check V2 #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

String asyncJobId = 'dbjid:AACUbbYLC4V4a58VE3L923XCBH5myG1_qK33mhOjwS5p-7YxylZCpnhcLMlCNCmEA5oQAJMJIYQZkaLee05zMIXW';

var data = await dropboxFile.moveBatchCheckV2(asyncJobId);
}

copied to clipboard
Paper Create #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.paperCreate(
'/Desktop/document.paper',
importFormat: ImportFormat.html,
);
}

copied to clipboard
Paper Update #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.paperUpdate('');
}

copied to clipboard
Permanently Delete #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.permanentlyDelete('/Desktop/orders.json');
}

copied to clipboard
Restore File #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.restoreFile('/Documents/file.txt', '/Documents/file.txt');
}

copied to clipboard
Save URL #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.saveUrl('', '');
}

copied to clipboard
Check Job Status #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.checkJobStatus('');
}

copied to clipboard
Search Files #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.searchFiles('orders');
}

copied to clipboard
Search Continue #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.searchContinue('');
}

copied to clipboard
Add Tag #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.addTag('/Desktop/orders.json', 'sdkTest');
}

copied to clipboard
Get Tags #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.getTags(['/Desktop/orders.json']);
}

copied to clipboard
Remove Tag #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.removeTag('/Desktop/orders.json', 'sdkTest');
}

copied to clipboard
Unlock File Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.unlockFileBatch(['/Desktop/orders.json']);
}

copied to clipboard
Upload File #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadFile(File('/Me/Desktop/dev_ttmp/main.dart'), destinationPath: '/Documents/main.dart');
}

copied to clipboard
Upload Session Append #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadSessionAppend(File(''), sessionID: '', offset: 3);
}

copied to clipboard
Upload Session Finish #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadSessionFinish('', 0, '');
}

copied to clipboard
Upload Session Finish Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

List<UploadSessionFinishArg> entries = [
UploadSessionFinishArg(
cursor: UploadSessionCursor(sessionId: '', offset: 0),
commit: CommitInfo(
path: '/Homework/math/Matrices.txt',
mode: WriteMode.add,
autorename: true,
clientModified: DateTime.now(),
mute: false,
propertyGroups: [
PropertyGroup(
templateId: 'your_template_id',
fields: [
PropertyField(name: 'name', value: 'Bob'),
]
),
],
strictConflict: false,
contentHash: 'contentHash123',
),
),
];

var data = await dropboxFile.uploadSessionFinishBatch(entries);
}

copied to clipboard
Upload Session Finish Batch Check #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadSessionFinishBatchCheck('');
}

copied to clipboard
Upload Session Start #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadSessionStart(File(''));
}

copied to clipboard
Upload Session Start Batch #

Future<void> method() async {
// Get DropboxFile Instance
DropboxFile dropboxFile = DropboxFile(yourDropboxAppInstance);

var data = await dropboxFile.uploadSessionStartBatch(0);
}

copied to clipboard
Ensure to replace yourDropboxAppInstance with the appropriate initialization of your DropboxApp instance.
BYBY #
We hope this SDK makes your interactions with the Dropbox API easier when developing your Dart/Flutter projects.
If you have any questions, suggestions or encounter any problems, feel free to get in touch.
You can visit the repository on Github to learn more about it. Happy coding!
Hey! Run, run! Small Dropbox!

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator