Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/therookiecoder/drive_helper
Thin wrapper for interfacing with Google Drive and Google sign in, in Flutter
https://github.com/therookiecoder/drive_helper
dart flutter google-drive google-sign-in
Last synced: 3 months ago
JSON representation
Thin wrapper for interfacing with Google Drive and Google sign in, in Flutter
- Host: GitHub
- URL: https://github.com/therookiecoder/drive_helper
- Owner: theRookieCoder
- License: bsd-3-clause
- Created: 2021-05-09T17:11:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-26T16:15:20.000Z (10 months ago)
- Last Synced: 2024-07-30T18:53:44.526Z (5 months ago)
- Topics: dart, flutter, google-drive, google-sign-in
- Language: Dart
- Homepage: https://pub.dev/packages/drive_helper
- Size: 121 KB
- Stars: 12
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Drive Helper
Drive Helper is an easy to use library for interfacing with Google Drive and Google sign in.
It is a thin wrapper around `google_sign_in` and `googleapis`, making it much more intuitive for developers to use and integrate Google Drive into a project. If you already use the Drive API, then you probably have a wrapper class for initialisation and read/write, you can likely easily replace it with Drive Helper.## Get started
Follow the instruction in the [tutorial](https://github.com/theRookieCoder/drive_helper/blob/main/doc/DriveHelper.md) to start using Drive Helper in your Flutter project, or migrate to it for an existing app.
## Features
- Signs in to Google and maintains the account for you
- Exposed `DriveAPI`, `GoogleSignIn`, and `GoogleSignInAccount` to help with possibly missing functionality
- Provides methods for
- Signing in to and signing out or disconnecting from Google accounts
- Searching, creating, reading, overwriting, appending, and deleting files
- Getting the account's name, email address, or avatar
- Predefined MIME types for use in creating and exporting files
- Predefined permission scopes for easily picking a suitable permission level apt for your purposes## Example
To have a look at an app that uses this library, see the app that inspired Drive Helper, [BP Logger](https://www.github.com/theRookieCoder/bp_logger).
The code below shows how to initialise the library:
```dart
class MyApp extends StatelessWidget {
late DriveHelper driveHelper;Widget build() {
return MaterialApp(
// Theming and other setting
body: FutureBuilder(
future: () async => await driveHelper = DriveHelper.initialise([
// Choose your scopes
]),
builder: (snapshot, context) {
if (snapshot.connectionState == ConnectionState.done &&
!snapshot.hasError) {
return HomePage(driveHelper: driveHelper);
} else if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasError) {
return ErrorPage(error: snapshot.error);
} else {
return Container(
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width / 1.5,
child: CircularProgrssIndicator(strokeWidth: 10),
);
}
}
),
);
}
}
```