gmail_client_flutter 1.0.1 copy "gmail_client_flutter: ^1.0.1" to clipboard
gmail_client_flutter: ^1.0.1 copied to clipboard

Flutter bindings for gmail_client — Riverpod providers, Google Sign-In, and platform-specific OAuth utils for Gmail integration.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gmail_client_flutter/gmail_client_flutter.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Supabase.initialize(
    url: 'https://your-project.supabase.co',
    publishableKey: 'your-anon-key',
  );

  runApp(const ProviderScope(child: GmailClientExampleApp()));
}

class GmailClientExampleApp extends StatelessWidget {
  const GmailClientExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Gmail Client Example',
      theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.blue),
      home: const InboxExamplePage(),
    );
  }
}

class InboxExamplePage extends ConsumerWidget {
  const InboxExamplePage({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final state = ref.watch(inboxProvider);
    final isConnected = ref.watch(emailConnectionProvider);

    return Scaffold(
      appBar: AppBar(title: const Text('Gmail Client Example')),
      body: isConnected.maybeWhen(
        data: (connected) => !connected
            ? const Center(child: Text('Connect your Gmail account'))
            : state.isLoading
                ? const Center(child: CircularProgressIndicator())
                : ListView.builder(
                    itemCount: state.emails.length,
                    itemBuilder: (_, i) => ListTile(
                      title: Text(state.emails[i].subject ?? ''),
                      subtitle: Text(state.emails[i].from ?? ''),
                    ),
                  ),
        orElse: () => const Center(child: CircularProgressIndicator()),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => ref.read(inboxProvider.notifier).refresh(),
        child: const Icon(Icons.refresh),
      ),
    );
  }
}
0
likes
130
points
94
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter bindings for gmail_client — Riverpod providers, Google Sign-In, and platform-specific OAuth utils for Gmail integration.

Repository (GitHub)
View/report issues

Topics

#gmail #email #supabase #riverpod #google-sign-in

License

MIT (license)

Dependencies

extension_google_sign_in_as_googleapis_auth, file_picker, flutter, flutter_riverpod, gmail_client, google_sign_in, supabase_flutter

More

Packages that depend on gmail_client_flutter