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

PlatformAndroid

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _filePickerAndroidPlugin = FilePickerAndroid();
  String _filePaths = '';

  void pickFiles({bool? openMultiple, List<String>? acceptTypes}) async {
    List<String> result = await _filePickerAndroidPlugin.pickFile(openMultiple: openMultiple, acceptTypes: acceptTypes);

    setState(() {
      _filePaths = result.join('\n');
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            spacing: 10,
            children: [
              Text('FilePaths:\n$_filePaths'),

              FilledButton(onPressed: () => pickFiles(), child: Text('Pick Single File')),
              FilledButton(onPressed: () => pickFiles(openMultiple: true), child: Text('Pick Multiple Files')),
              FilledButton(onPressed: () => pickFiles(openMultiple: true, acceptTypes: ['image/*']), child: Text('Pick Multiple Image')),
              FilledButton(onPressed: () => pickFiles(acceptTypes: ['image/*']), child: Text('Pick Single Image')),
              FilledButton(onPressed: () => pickFiles(acceptTypes: ['video/*']), child: Text('Pick Single Video')),
              FilledButton(onPressed: () => pickFiles(openMultiple: true, acceptTypes: ['video/*', 'image/*']), child: Text('Pick Multiple Image or Video')),
              FilledButton(onPressed: () => pickFiles(acceptTypes: ['image/jpeg']), child: Text('Pick Single jpeg')),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
105
downloads

Publisher

unverified uploader

Weekly Downloads

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on file_picker_android

Packages that implement file_picker_android