Skip to content
This repository was archived by the owner on Jul 21, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
177f60c
Update example's .gitignore files.
greymag May 3, 2021
23b7ca9
Migrate to null safety.
greymag May 3, 2021
43e64dd
Add embedding version 2
mongugay Nov 29, 2021
7b6d750
Change to MethodChannel, FlutterPlugin.
mongugay Nov 29, 2021
6bee807
Change place code.
mongugay Nov 29, 2021
9f2d4bb
Merge pull request #1 from Innim/feature/migrating-V2
greymag Nov 29, 2021
4c7a272
iOS project files
greymag Feb 21, 2022
e9ef2a7
Refactor
greymag Feb 21, 2022
57bd89a
Example: embedding-v2
greymag Feb 21, 2022
c60f41a
Changed name: esys_flutter_share_plus
greymag Feb 21, 2022
dab85d3
Update gitignore
greymag Feb 21, 2022
8fe9a8a
Remove redundant files.
greymag Feb 21, 2022
f47449d
Use "platforms" instead of deprecated "androidPackage" and "pluginCla…
greymag Feb 21, 2022
2f8614f
Min Flutter v2.0
greymag Feb 21, 2022
237ee82
Fixed: failed to run because native plugins wasn't rename.
greymag Feb 21, 2022
a396174
Example: Updated Android.
greymag Feb 21, 2022
c92e24d
Example: Create/update iOS files.
greymag Feb 21, 2022
a436c31
v2.1.0
greymag Feb 21, 2022
71198ea
Fixed bug by granting permission. So now granting permission for the …
stokkato Jul 20, 2022
a63f6ef
Merge pull request #2 from Innim/feature/fix-granting-permission-uri
greymag Jul 20, 2022
b39ac8d
Fix share file with text. When the text with one file was not shown. …
mongugay Aug 12, 2022
3163310
Update build.gradle (#4)
krausecloudcrm Dec 4, 2024
039fec3
Out of memory fix (#5)
Vabiel Dec 4, 2024
9235812
Update CHANGELOG.md
Vabiel Dec 4, 2024
9cca0b3
update constraint
greymag Dec 4, 2024
b743048
Added new method `deleteTempShareFilesByExtension` for removing tempo…
ulezkin Aug 8, 2025
87c8f13
Fixed: broken share
ulezkin Aug 29, 2025
7b8016d
ci: analyze and publish
greymag Jan 14, 2026
a2b7f1b
Feature/share in separate activity (#8)
j3kaiii Jan 14, 2026
6a00b95
fix(android): temporary files were deleted before share completed (#9)
j3kaiii Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Analyze & Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Analyze project source
run: flutter analyze

# No test for now
# - name: Run tests
# run: flutter test
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
workflow_run:
workflows: ["Analyze & Test"]
types: [completed]
branches: [master]

workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
- name: Dart and Flutter Package Publisher
uses: k-paxian/dart-package-publisher@v1.5.1
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
skipTests: true
flutter: true
23 changes: 15 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Flutter/Dart/Pub related
.DS_Store
.dart_tool/
.idea/

.packages
.pub/
pubspec.lock

build/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Visual Studio Code related
# VSCode settings
.vscode/

android/.settings/
android/.classpath
android/.project
example/android/.settings/
example/android/.classpath
example/android/.project
example/android/app/.settings/
example/android/app/.classpath
example/android/app/.project

# FVM
.fvm/
71 changes: 70 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
# 2.5.1

* **Fixed** Android: an issue where files were deleted before being shared to another activity.
* **Added** public method `clean()` to trigger the cleanup of the temporary files directory.

## 2.5.0

* Update Android `compileSdkVersion` to 35
* Update Android `minSdkVersion` to 21
* Update Android `gradle` version to 8.10
* Update Android example app.
* On Android sharing now launches in a separate Activity by default. To keep it in the current Activity, set `useSeparateActivity: false` in the `init` method.

## 2.4.0+1

* **Fixed** Fix share file error on ios.

## 2.4.0

* **Added** new method `init()` for initializing the Share plugin and cleaning up temporary files.
This method should be called at app startup or before starting to work with sharing.
* Implemented automatic deletion of temporary files created in `filesFromStorage` and
`fileFromStorage` after sharing is completed (when the share window is closed).

## 2.3.0

* **Added** new methods `fileFromMemory()` and `filesFromMemory()` for sharing small files using
byte arrays. These methods should be used cautiously and are **not recommended for large files**
due to potential memory issues.
* **Added** new methods `fileFromStorage()` and `filesFromStorage()` for sharing files using file
paths. These methods are **recommended** for general use, especially with large files, to avoid
memory-related errors.
* **Added** explicit namespace declaration for compatibility with latest Android Gradle Plugin.
* **Deprecated** methods `file()` and `files()`. It is recommended to use `fileFromStorage()` and
`filesFromStorage()` instead. For small files, `fileFromMemory()` and `filesFromMemory()` can be
used, but they are not recommended for large files due to potential memory issues.
* **Updated documentation** to clearly state the intended use cases for each method and to guide
users toward the recommended approaches.
* **Breaking change**: If you are using the deprecated methods `file()` and `files()`, please switch
to the new methods to avoid possible memory issues.

## 2.2.0

* Fix share file with text. When the text with one file was not shown.
* Detailed file type processing.
* **Breaking change**. To `files()` you need to pass the `mimeType` array.

## 2.1.1

* Fixed bug by granting permission. So now granting permission for the uri for each resolvable
application.

## 2.1.0

* Published as `esys_flutter_share_plus`.
* `compileSdkVersion` upgraded to 31.

## 2.0.1

* migrate to V2

## 2.0.0

* migrate to null safety
* update path_provider to 2.0.0

## 1.0.3

* update example app
Expand All @@ -18,7 +84,10 @@

## 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](https://developer.android.com/jetpack/androidx/migrate) if they're using the original support library.
* 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](https://developer.android.com/jetpack/androidx/migrate) if they're using the
original support library.

## 0.0.8

Expand Down
60 changes: 53 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# esys_flutter_share
# esys_flutter_share_plus

It's fork of [esys_flutter_share](https://github.com/esysberlin/esys-flutter-share).

A [Flutter](https://flutter.io) plugin for sharing files & text with other applications.

Expand Down Expand Up @@ -28,12 +30,28 @@ 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](https://github.com/flutter/flutter/issues/16049).

## IMPORTANT Note for Android
On Android, the Share function launches by default in a separate system task and activity. This maintains the cleanliness of your application's navigation stack. However, in this mode, the application cannot wait for the process to complete or reliably receive its result.

Therefore, we cannot determine precisely whether the user has finished sharing the file to safely delete the temporary files. As a result, the temporary file directory is cleared each time a new sharing operation is initiated.

You can also force a cleanup when you are certain the user has finished with the Share function (for example, when leaving the screen of your app from which sharing was launched). To do this, use the `clean()` method.

Alternative option: You can disable launching in a separate system activity by setting the parameter `useSeparateActivity: false` in the `init()` method. In this case, the result of the Share operation will be returned to your application, and the cleanup of temporary files will happen automatically.

## Usage

Import:

```dart
import 'package:esys_flutter_share/esys_flutter_share.dart';
import 'package:esys_flutter_share_plus/esys_flutter_share_plus.dart';
```

Initialize the plugin (required):

```dart
// Call this method at app startup or before starting to work with sharing
await Share.init();
```

Share text:
Expand All @@ -42,21 +60,49 @@ Share text:
Share.text('my text title', 'This is my text to share with other applications.', 'text/plain');
```

Share file:
Share File from Storage (Recommended):
**Note:** This method is recommended for sharing files, especially large files, to avoid potential memory issues.

```dart
await EsysFlutterShare.fileFromStorage(
'Share File',
'example.pdf',
'/path/to/your/example.pdf',
'application/pdf',
text: 'Check out this file!',
);
```

Share File from Memory (Use with Caution):
**Warning:** Use this method only for small files. For large files, use fileFromStorage to avoid potential out-of-memory errors.

```dart
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.');
await Share.fileFromMemory('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png', text: 'My optional text.');
```

Share Multiple Files from Storage (Recommended):

```dart
await EsysFlutterShare.filesFromStorage(
'Share Files',
{
'image1.png': '/path/to/your/image1.png',
'document.pdf': '/path/to/your/document.pdf',
},
{'image/png', 'application/pdf'},
text: 'Here are some files!',
);
```

Share files:
Share Multiple Files from Memory (Use with Caution):

```dart
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(
await Share.filesFromMemory(
'esys images',
{
'esys.png': bytes1.buffer.asUint8List(),
Expand All @@ -73,7 +119,7 @@ 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');
await Share.fileFromMemory('ESYS AMLOG', 'amlog.jpg', bytes, 'image/jpg');
```

Check out the example app in the Repository for further information.
Expand Down
1 change: 0 additions & 1 deletion android/.idea/.name

This file was deleted.

Binary file removed android/.idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions android/.idea/codeStyles/Project.xml

This file was deleted.

17 changes: 0 additions & 17 deletions android/.idea/gradle.xml

This file was deleted.

38 changes: 0 additions & 38 deletions android/.idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions android/.idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions android/.idea/runConfigurations.xml

This file was deleted.

Loading