file_picker_pro 1.6.0 copy "file_picker_pro: ^1.6.0" to clipboard
file_picker_pro: ^1.6.0 copied to clipboard

Flutter plugin for selecting files from any devices file library, and taking a new pictures with the camera.

example/lib/main.dart

import 'dart:developer';
import 'package:file_picker_pro/file_data.dart';
import 'package:file_picker_pro/file_picker.dart';
import 'package:file_picker_pro/files.dart';
import 'package:flutter/material.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  FileData _fileData = FileData();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('file_picker_pro'),
        ),
        body: SafeArea(
          child: Column(
            children: [
              FilePicker(
                  context: context,
                  height: 100,
                  fileData: _fileData,
                  crop: true,
                  maxFileSizeInMb: 10,
                  allowedExtensions: const [
                    Files.txt,
                    Files.png,
                    Files.jpg,
                    Files.pdf
                  ],
                  onSelected: (fileData) {
                    _fileData = fileData;
                    log(fileData.filePath);
                    setState(() {});
                  },
                  onCancel: (message, messageCode) {
                    log("[$messageCode] $message");
                  }),
            ],
          ),
        ),
      ),
    );
  }
}
14
likes
130
pub points
84%
popularity

Publisher

verified publisherdatadirr.com

Flutter plugin for selecting files from any devices file library, and taking a new pictures with the camera.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

file_picker, flutter, flutter_web_plugins, image_cropper, image_picker, mime, open_share_plus, plugin_platform_interface

More

Packages that depend on file_picker_pro