v1.8.2
flutter_onedrive
Dateien hochladen/herunterladen auf/from OneDrive
27Likes 57730-Tage-Downloads140Pub-Punkte
AndroidiOSmacOSWindows
Lukiya/flutter_onedrive open-source repository details.
{"sdk":"flutter"}>=9.2.4 <11.0.0>=1.0.0 <2.0.0>=2.0.0 <3.0.0^5.1.0>=1.8.0 <3.0.0{"sdk":"flutter"}^5.0.0Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.
Read below documents before you start using this library:
flutter public add flutter_onedrive
import 'package:flutter_onedrive/flutter_onedrive.dart';
final onedrive = OneDrive(redirectURL: "your redirect URL", clientID: "your client id");
return FutureBuilder(
future: onedrive.isConnected(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (!snapshot.hasData) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.data ?? false) {
// Has connected
return const Text("Connected");
} else {
// Hasn't connected
return MaterialButton(
child: const Text("Connect"),
onPressed: () async {
final success = await onedrive.connect(context);
if (success) {
// Create directories
OneDriveResponse response = await onedrive.createDirectory("/test");
// Upload files
const str = "Hello, World!";
var data = Uint8List.fromList(utf8.encode(str));
response = await onedrive.push(data, "/test/hello.txt");
// Download files
response = await onedrive.pull("/test/hello.txt");
// List files
final files = await onedrive.listFiles("/test/");
// Delete files
response = await onedrive.deleteFile("/test/hello.txt");
// Delete directories
response = await onedrive.deleteFile("/test");
}
},
);
}
},
);