android_content_provider 0.3.0 android_content_provider: ^0.3.0 copied to clipboard
Flutter plugin to use ContentProvider/ContentResolver APIs on Android
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'books_page.dart';
import 'media_store_songs_page.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const ProviderScope(child: MyApp()));
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(
builder: (context) => Scaffold(
appBar: AppBar(
title: const Text('AndroidContentResolver example'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
child: const Text('Books example (provider from example_provider)'),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const BooksPage()),
);
},
),
ElevatedButton(
child: const Text('MediaStore songs example (common Android provider)'),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const MediaStoreSongsPage()),
);
},
),
],
),
),
),
);
}
}