flutter_onedrive 1.6.2 copy "flutter_onedrive: ^1.6.2" to clipboard
flutter_onedrive: ^1.6.2 copied to clipboard

Upload/download files to/from onedrive

Features #

  • Download files from onedrive
  • Upload files to onedrive

References #

Read below documents before you start using this library:

Getting started #

flutter public add flutter_onedrive
import 'package:flutter_onedrive/flutter_onedrive.dart';

Usage #

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) {
            // Download files
            final response = await onedrive.pull("/xxx/xxx.txt");
            // Upload files
            await onedrive.push(response.bodyBytes!, "/xxx/xxx.txt");
          }
        },
      );
    }
  },
);
22
likes
100
pub points
82%
popularity

Publisher

unverified uploader

Upload/download files to/from onedrive

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_secure_storage, http, oauth_webauth

More

Packages that depend on flutter_onedrive