memoryfilepicker 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new83

Memory File Picker #

A simple memory file picker for Flutter on Android, iOS and web. This package makes it possible to use a file picker on Flutter for web while it provides the same API for both web and mobile. On web it will read the file using the dart HTML FileReader object while on mobile it just calls the FilePicker or ImagePicker packages.

Getting Started #

Just use this as a replacement for:

  • (File Picker)[https://pub.dev/packages/file_picker]
  • (Image Picker)[https://pub.dev/packages/image_picker]

The file will be loaded to the memory so make sure to not load too big files.

[0.1.1] - 2020-06-20 #

  • Minor fixes

[0.1.0] - 2020-06-20 #

  • First release

example/main.dart

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:memoryfilepicker/memoryfilepicker.dart';

void main() {
  runApp(MemoryFilePickerTestApp());
}

class MemoryFilePickerTestApp extends StatefulWidget {
  @override
  _MemoryFilePickerTestAppState createState() =>
      _MemoryFilePickerTestAppState();
}

class _MemoryFilePickerTestAppState extends State<MemoryFilePickerTestApp> {
  MemoryFile file;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: file == null
              ? RaisedButton(
                  child: Text('Pick image'),
                  onPressed: () async {
                    final picked = await MemoryFilePicker.getImage(
                      source: ImageSource.gallery,
                    );
                    if (picked != null) {
                      setState(() => file = picked);
                    }
                  },
                )
              : MemoryImage(file.bytes),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  memoryfilepicker: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:memoryfilepicker/memoryfilepicker.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:memoryfilepicker/memoryfilepicker.dart that imports:
  • package:image_picker/image_picker.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:memoryfilepicker/memoryfilepicker.dart that imports:
  • package:image_picker/image_picker.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:memoryfilepicker/memoryfilepicker.dart that imports:
  • package:image_picker/image_picker.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:memoryfilepicker/memoryfilepicker.dart that imports:
  • package:image_picker/image_picker.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • memoryfilepicker that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
file_picker ^1.12.0 1.12.0
flutter 0.0.0
image_picker ^0.6.7+2 0.6.7+4
universal_html ^1.2.3 1.2.3
Transitive dependencies
async 2.4.2
charcode 1.1.3
collection 1.14.12 1.14.13
csslib 0.16.1
file_picker_platform_interface 1.2.0
flutter_plugin_android_lifecycle 1.0.8
html 0.14.0+3
http 0.12.1
http_parser 3.1.4
image_picker_platform_interface 1.1.0
meta 1.1.8 1.2.2
path 1.7.0
plugin_platform_interface 1.0.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
universal_io 1.0.1
vector_math 2.0.8 2.1.0-nullsafety
zone_local 0.1.2
Dev dependencies
flutter_test
pedantic ^1.9.0 1.9.0 1.9.2