light_weight_picker 0.0.1 copy "light_weight_picker: ^0.0.1" to clipboard
light_weight_picker: ^0.0.1 copied to clipboard

A file picker plugin without any dependencies.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:light_weight_picker/light_weight_picker.dart';
import 'package:light_weight_picker/selected_file.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 _lightWeightPickerPlugin = LightWeightPicker();

  _pickFile() async {
    SelectedFile? selectedFile = await _lightWeightPickerPlugin
        .browseAndGetFile(fileType: [FileTypes.all]);
    if (selectedFile != null) {
      debugPrint(selectedFile.fileName.toString());
      debugPrint(selectedFile.fileExtension.toString());
      debugPrint(selectedFile.fileBytes.toString());
    }
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: _pickFile,
            child: const Text("Browse"),
          ),
        ),
      ),
    );
  }
}
2
likes
140
points
216
downloads

Publisher

unverified uploader

Weekly Downloads

A file picker plugin without any dependencies.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on light_weight_picker

Packages that implement light_weight_picker