cloud_sync_google_drive_adapter 0.0.1-rc.2 copy "cloud_sync_google_drive_adapter: ^0.0.1-rc.2" to clipboard
cloud_sync_google_drive_adapter: ^0.0.1-rc.2 copied to clipboard

A Flutter plugin for integrating Google Drive cloud sync functionality.

CloudSyncGoogleDriveAdapter #

A Google Drive-based implementation of the SyncAdapter interface from the cloud_sync package.
This adapter enables two-way synchronization of metadata and string-based detail content with the user's Google Drive, using file descriptions and binary content for storage.


✨ Features #

  • πŸ”„ Syncs metadata (SyncMetadata) and string detail content (String) via Google Drive files.
  • πŸ“₯ Fetches a list of metadata from Drive.
  • πŸ“€ Uploads new files or updates existing ones using metadata ID.
  • πŸ’Ύ Stores detail as file content and metadata as file description.
  • πŸ“¦ Operates in appDataFolder by default to isolate app-specific files.

πŸ“¦ Installation #

Add dependencies in your pubspec.yaml:

dependencies:
  cloud_sync: ^latest
  cloud_sync_google_drive_adapter: ^latest
  google_sign_in: ^latest

πŸš€ Usage #

import 'package:cloud_sync_google_drive_adapter/cloud_sync_google_drive_adapter.dart';
import 'package:http/http.dart' as http;
import 'your_models/sync_metadata.dart'; // Your custom metadata model

final adapter = CloudSyncGoogleDriveAdapter<MyMetadata>.fromClient(
  client: authClient, // Use authenticated client
  metadataToJson: (meta) => jsonEncode(meta.toJson()),
  metadataFromJson: (json) => MyMetadata.fromJson(jsonDecode(json)),
);

To create with a client only:

final adapter = CloudSyncGoogleDriveAdapter<MyMetadata>.fromClient(
  client: authClient,
  metadataToJson: ...,
  metadataFromJson: ...,
);

πŸ“ Class Overview #

class CloudSyncGoogleDriveAdapter<M extends SyncMetadata>
  extends SerializableSyncAdapter<M, String>
  • spaces: Google Drive spaces to use (default: 'appDataFolder')
  • fileName: Drive file name used to identify synced data
  • Implements:
    • fetchMetadataList() β†’ List of files with metadata in descriptions
    • fetchDetail() β†’ Decoded file content
    • save() β†’ Create or update file in Drive

βœ… When to Use #

  • ☁️ You want cloud backup or multi-device sync.
  • πŸ”’ You’re storing encrypted data or structured content.
  • πŸ“± Perfect for apps syncing notes, tasks, logs, or media references.

πŸ“„ License #

MIT (or your project’s license)


2
likes
0
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for integrating Google Drive cloud sync functionality.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cloud_sync, googleapis, http

More

Packages that depend on cloud_sync_google_drive_adapter