Search packages, repositories and app categories

Package detailsv1.8.3

flutter_onedrive

Upload/download files to/from onedrive

AndroidiOSmacOSWindows
30-day downloads
568
Likes
27
Pub points
140

Install package

flutter pub add flutter_onedrive

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter package that enables seamless upload and download of files to and from Microsoft OneDrive. It provides a straightforward interface for integrating OneDrive cloud storage into Flutter applications across Android, iOS, macOS, and Windows. The package handles authentication via OAuth 2.0 and supports file operations such as creating, reading, updating, and deleting files in OneDrive folders. Ideal for apps requiring secure cloud file management with Microsoft's ecosystem.

Use cases

  • File backup and sync
  • Cloud-based document sharing
  • User profile data storage
  • Integration with Microsoft Office workflows
  • Offline-first app data persistence

Key features

  • OneDrive OAuth 2.0 authentication
  • Cross-platform support (Android, iOS, macOS, Windows)
  • File upload and download methods
  • Folder navigation and management
  • Error handling for network and permission issues

Suitable for

  • Apps needing cloud file access
  • Developers using Microsoft services
  • Products requiring secure file storage
  • Educational or enterprise apps
  • Mobile and desktop hybrid applications

Considerations

  • Requires proper OneDrive API permissions
  • Needs user consent for OAuth flow
  • May require backend for token refresh
  • Limited to OneDrive-specific features
  • Dependent on internet connectivity

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Features

  • Download files from onedrive
  • Upload files to onedrive
  • List files
  • Create directory
  • Delete files

References

Read below documents before you start using this library:

  • https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/app-registration?view=odsp-graph-online
  • https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth?view=odsp-graph-online
  • https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/special-folders-appfolder?view=odsp-graph-online
  • https://github.com/LinusU/flutter_web_auth

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) {
            // 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");
          }
        },
      );
    }
  },
);

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package

No data available yet.