esys_flutter_share 1.0.2

esys_flutter_share #

A Flutter plugin for sharing files & text with other applications.

IMPORTANT Note for iOS #

If you are starting a new fresh app, you need to create the Flutter App with flutter create -i swift (see flutter/flutter#13422 (comment)), otherwise, you will get this message:

=== BUILD TARGET flutter_inappbrowser OF PROJECT Pods WITH CONFIGURATION Debug ===
The "Swift Language Version" (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

If you still have this problem, try to edit iOS Podfile like this (see #15):

target 'Runner' do
  use_frameworks!  # required by simple_permission
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.0'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Instead, if you have already a non-swift project, you can check this issue to solve the problem: Friction adding swift plugin to objective-c project.

Usage #

Import:

import 'package:esys_flutter_share/esys_flutter_share.dart';

Share text:

Share.text('my text title', 'This is my text to share with other applications.', 'text/plain');

Share file:

final ByteData bytes = await rootBundle.load('assets/image1.png');
await Share.file('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png', text: 'My optional text.');

Share files:

final ByteData bytes1 = await rootBundle.load('assets/image1.png');
final ByteData bytes2 = await rootBundle.load('assets/image2.png');
final ByteData bytes3 = await rootBundle.load('assets/addresses.csv');

await Share.files(
    'esys images',
    {
        'esys.png': bytes1.buffer.asUint8List(),
        'bluedan.png': bytes2.buffer.asUint8List(),
        'addresses.csv': bytes3.buffer.asUint8List(),
    },
    '*/*',
    text: 'My optional text.');

Share file from url:

var request = await HttpClient().getUrl(Uri.parse('https://shop.esys.eu/media/image/6f/8f/af/amlog_transport-berwachung.jpg'));
var response = await request.close();
Uint8List bytes = await consolidateHttpClientResponseBytes(response);
await Share.file('ESYS AMLOG', 'amlog.jpg', bytes, 'image/jpg');

Check out the example app in the Repository for further information.

1.0.2 #

  • update path_provider to 1.1.0
  • optional text share added to Share.file & Share.files methods
  • suppression of warnings "unchecked" in java code

1.0.1 #

  • Update readme

1.0.0 #

  • Breaking change. Adds support for sharing single and multiple files.

0.0.9 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.0.8 #

  • update path_provider to v0.5.0

0.0.7 #

  • update compileSdkVersion to 28 and com.android.support:support-v4 to 28.0.0

0.0.6 #

  • fixes crashes on iPad

0.0.5 #

  • Use FileProvider subclass to avoid collisions

0.0.4 #

  • meta information added

0.0.3 #

  • meta information added

0.0.2 #

  • meta information added

0.0.1 #

  • initial release

example/README.md

Example #

Check out the Example App in the Repository.

Use this package as a library

1. Depend on it

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


dependencies:
  esys_flutter_share: ^1.0.2

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:esys_flutter_share/esys_flutter_share.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
96
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]
98
Learn more about scoring.

We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/esys_flutter_share.dart.

Run flutter format to format lib/esys_flutter_share.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
path_provider ^1.1.0 1.3.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
platform 2.2.1
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8