google_drive_file_picker 0.0.2 copy "google_drive_file_picker: ^0.0.2" to clipboard
google_drive_file_picker: ^0.0.2 copied to clipboard

The google_drive_file_picker plugin for Flutter is a package that allows users to browse, select, and retrieve files from their Google Drive directly within a Flutter application. It simplifies the pr [...]

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:google_drive_file_picker/google_drive_file_picker.dart';

void main() {
  runApp(
    const MaterialApp(
      home: GoogleDriveTestApp(),
    ),
  );
}

class GoogleDriveTestApp extends StatefulWidget {
  const GoogleDriveTestApp({
    super.key,
  });

  @override
  State<GoogleDriveTestApp> createState() => _GoogleDriveTestAppState();
}

class _GoogleDriveTestAppState extends State<GoogleDriveTestApp> {
  final GoogleDriveController controller = GoogleDriveController();
  File? _file;

  @override
  void initState() {
    controller.setAPIKey(apiKey: 'your_api_key');
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Test Google drive file picker'),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          const SizedBox(
            height: 30,
          ),
          ElevatedButton(
            onPressed: () async {
              final file = await controller.getFileFromGoogleDrive(
                context: context,
              );

              if (file != null) {
                setState(() {
                  _file = file;
                });
              }
            },
            child: const Text(
              'Open google drive',
            ),
          ),
          const SizedBox(
            height: 30,
          ),
          Text(
            _file?.path ?? '--',
            textAlign: TextAlign.center,
          ),
        ],
      ),
    );
  }
}
2
likes
130
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

The google_drive_file_picker plugin for Flutter is a package that allows users to browse, select, and retrieve files from their Google Drive directly within a Flutter application. It simplifies the process of integrating Google Drive file access by handling authentication, file listing, and downloading.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_sign_in, googleapis, http, path_provider, pull_to_refresh_flutter3

More

Packages that depend on google_drive_file_picker