Coder Social home page Coder Social logo

natsuk4ze / gal Goto Github PK

View Code? Open in Web Editor NEW
71.0 2.0 11.0 65.67 MB

How to Save Image or Video to Photo Gallery in Flutter

Home Page: https://pub.dev/packages/gal

License: BSD 3-Clause "New" or "Revised" License

Java 24.22% Dart 35.48% Ruby 2.04% Swift 16.03% CMake 4.89% C++ 16.22% C 1.12%
dart flutter gallery image java plugin swift video package dart-library

gal's Introduction

Hoya👋

I'm Midori Natuskaze. Formerly a game developer and now a Flutter engineer.

GitHub Stats Card

💙 Flutter Projects

Project Preview
nomap 🗺️ - navigation app without map

gal gal
Gal 🖼 - Flutter plugin for handle native gallery apps

gal
gal gal
npm client 📦 - npm client app with modern flutter coding style

npm
npm-client npm-client
CompassX 🧭 - Compass Plugin for flutter

compassx
compassx
Planet 📚 - CMS for story writer made with flutter web.

🔗 Website
planet

🧙 Flutter UI Challenges

🌈 Holo effects 🤩 RGB effects


holo

holo
rgb

rgb_lights

🎮 Game Projects

Project Preview
Link 🏢

3D simulation game created by the team at HAL Tokyo🏫 using DirectX. HAL Grand Prize🏅
link
City Star Liner 🌌

3D shooting game created by the team RedCopper👒 at HAL Tokyo🏫 using DirectX.
citystarliner
Tank Beats 🎵

3D music x shooting game ceated by Midori using DirectX.
Tank Beats
Space Rabbits 🐰

2D shooting game ceated by Midori using DirectX.
Space Rabbits

Awards 🎖

About Me

  • Birth - 2000
  • Location - Tokyo
  • Fav - Art🎨, Music🎵, ASMR🎙, Earing✨

gal's People

Contributors

dependabot[bot] avatar ellet0 avatar molihuan avatar natsuk4ze avatar noob8boi avatar zazo032 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gal's Issues

Add support for Linux desktop platform

Proposal

Hi, currently this plugin doesn't have support for Linux, if the maintainers of this repository are interested in adding support for Linux I can do that soon but I need to know if they are interested first

Usually, we do things in Linux in the command line for better support for all distros and it already maintained by open source community

but to execute the commands there are two places

  1. Either by checking if the platform is Linux and then executing them in dart code directly without having to use method channel (I prefer this way)
  2. Execute the commands in the method channel in the native plugin

Both will get the job done but I need to know which way the maintainers of this repository prefer to use

once I get a response I will start working on this as soon as I can

Use case

Linux support

Remove permission handling function

The goal is to make development smoother by making this package independent of the complexities of permission handling.
Needs provide extensive documentation as an alternative to functionality.
This is still up for discussion.

[iOS] cannot save to target album

Overview

Gal.putImage cannot save image to target album on iOS(iOS16) app.

help me.
thank you.

Code sample

Code sample
    await Gal.putImage(filePath, album: 'project_album');

Environment

Logs
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.13.2, on macOS 12.6 21G115 darwin-arm64, locale ja-JP)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.0.5/libexec/bin/dart, which is not inside your current Flutter SDK checkout at xxxxxx. Consider adding xxxxxxx to the front of your path.
    ! Upstream repository xxxxxxxx is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to xxxxxxx to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.81.1)
[✓] Connected device (5 available)
[✓] Network resources

Logs

Logs
Unhandled Exception: PlatformException(asset is not found, null, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      xxxxxxxx (project code)
<asynchronous suspension>
#3      xxxxxxxx (project code)
<asynchronous suspension>```

</details>

Compliance with Apple's Privacy Manifests

The purpose of this issue is to determine the policy for responding to Apple's Privacy Manifests.

Plugins that meet any of the following criteria should add PrivacyInfo.xcprivacy.

Currently, gal does not fall into either of these categories. Therefore, there are two options.

A. Do nothing.
B. Add an empty PrivacyInfo.xcprivacy

It seems better for the developer to take option B so that it is clear whether or not gal is already compatible with Privacy Manifests, but there is no need to rush and it can be done after sufficient research.

Windows platform cannot compile

Did you check the documentation and it did not help?

Overview

Windows platform cannot compile

Steps to reproduce

Clone this project and compile it on the Windows platform. Compilation error, Android platform can

Code sample

Official example of gal, 2023.11.5 10:27

Environment

Logs
[!] Flutter (Channel stable, 3.13.7, on Microsoft Windows [版本 10.0.19043.1586], locale zh-CN)
    • Flutter version 3.13.7 on channel stable at C:\Users\moli\fvm\default
    ! Warning: `flutter` on your path resolves to
      E:\DesktopSpace\Development\Environment\FlutterSDK\cache\3.13.7\bin\flutter, which is not inside your current
      Flutter SDK checkout at C:\Users\moli\fvm\default. Consider adding C:\Users\moli\fvm\default\bin to the front of
      your path.
    ! Warning: `dart` on your path resolves to E:\DesktopSpace\Development\Environment\FlutterSDK\cache\3.13.7\bin\dart,
      which is not inside your current Flutter SDK checkout at C:\Users\moli\fvm\default. Consider adding
      C:\Users\moli\fvm\default\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2f708eb839 (4 weeks ago), 2023-10-09 09:58:08 -0500
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly
      to perform update checks and upgrades.

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at E:\DesktopSpace\Development\Environment\Androidstudio\sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = E:\DesktopSpace\Development\Environment\Androidstudio\sdk
    • Java binary at: E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Users\moli\AppData\Local\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Professional 2019 16.11.24)
    • Visual Studio at E:\DesktopSpace\Development\Environment\vs2019\Professional
    • Visual Studio Professional 2019 version 16.11.33328.57
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.3)
    • Android Studio at E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = E:\DesktopSpace\Development\Environment\Androidstudio\Androidstudio
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] Connected device (6 available)
    • Redmi Note 8 Pro (mobile) • z5irov956llz69zh • android-arm64  • Android 10 (API 29)
    • GM1910 (mobile)           • 127.0.0.1:5555   • android-x64    • Android 9 (API 28)
    • GM1910 (mobile)           • emulator-5554    • android-x64    • Android 9 (API 28)
    • Windows (desktop)         • windows          • windows-x64    • Microsoft Windows [版本 10.0.19043.1586]
    • Chrome (web)              • chrome           • web-javascript • Google Chrome 119.0.6045.105
    • Edge (web)                • edge             • web-javascript • Microsoft Edge 114.0.1823.82 (unsupported)

Logs

Logs
[  +31 ms] CustomBuild:
[        ]   Building Custom Rule E:/DesktopSpace/Development/Flutter/gal/example/windows/flutter/ephemeral/.plugin_symlinks/gal/windows/CMakeLists.txt
[  +63 ms] ClCompile:
[        ]   E:\DesktopSpace\Development\Environment\vs2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\CL.exe /c /IE:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral /IE:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\cpp_client_wrapper\include /Zi /nologo /W4 /WX /diagnostics:column /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D _DEBUG /D FLUTTER_PLUGIN_IMPL /D UNICODE /D _UNICODE /D "CMAKE_INTDIR=\"Debug\"" /D gal_plugin_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++latest /Fo"gal_plugin.dir\Debug\\" /Fd"gal_plugin.dir\Debug\vc142.pdb" /external:W4 /Gd /TP /wd4100 /errorReport:queue  /await E:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\.plugin_symlinks\gal\windows\gal_plugin_c_api.cpp E:\DesktopSpace\Development\Flutter\gal\example\windows\flutter\ephemeral\.plugin_symlinks\gal\windows\gal_plugin.cpp
[  +42 ms]   gal_plugin_c_api.cpp
[ +902 ms]   gal_plugin.cpp
[+1477 ms] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(983,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1004,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1038,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1057,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(985): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncAction<D>�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1006): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncActionWithProgress<D,TProgress>�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1040): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncOperationWithProgress<D,TResult,TProgress>�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(103): message : ���winrt::impl�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ] C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1059): message : �鿴�����ڱ���� �� ģ�� ʵ������winrt::impl::consume_Windows_Foundation_IAsyncOperation<D,TResult>�������� [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[ +933 ms]   �������ɴ���...
[  +52 ms] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ�
[        ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\runner\example.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ�
[        ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\ALL_BUILD.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ�
[        ] �����������Ŀ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\INSTALL.vcxproj��(Ĭ��Ŀ��)�IJ��� - ʧ�ܡ�
[        ] ����ʧ�ܡ�
[   +2 ms] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\INSTALL.vcxproj��(Ĭ��Ŀ��) (1) ->
[        ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\ALL_BUILD.vcxproj��(Ĭ��Ŀ��) (3) ->
[        ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\runner\example.vcxproj��(Ĭ��Ŀ��) (4) ->
[        ] ��E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj��(Ĭ��Ŀ��) (7) ->
[        ] (ClCompile Ŀ��) -> 
[        ]     0 ������
[        ]     4 ������
[        ] ����ʱ�� 00:00:20.36
[{"event":"app.progress","params":{"appId":"c3034c50-4569-4226-85e4-80fbc8503c58","id":"0","progressId":null,"finished":true}}]
[        ]   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(983,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ]   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1004,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ]   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1038,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[        ]   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt/impl/Windows.Foundation.0.h(1057,26): error C2039: "wait_for": ���� "winrt::impl" �ij�Ա [E:\DesktopSpace\Development\Flutter\gal\example\build\windows\plugins\gal\gal_plugin.vcxproj]
[  +12 ms] Exception: Build process failed.
[   +2 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:662:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1297:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:115:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>

Support Android API 21-23

CompletableFuture in java8 is not available for Android API less than 24 and will crash.

completed:

  • open()
  • hasAccess()
  • requestAccess()
  • putImage()
  • putImageBytes()
  • putVideo()
  • add tests

Open Gallery to album

Proposal

Being able to save images to different albums is super nice but there isnt a great way in flutter (after much searching) to open a specific folder/album in gallery. Gals open is okay but i know WHAT im trying to open to and would be much nicer for the user if they could jump straight there instead of having to do another navigate.

Use case

being able to open a album/folder directly in the native app. For my use case is organizing the photos. Displaying them the default apps can do a better job. No need to reinvent the wheel here.

Improve Test

Exception throw makes the test fail correctly.

Next Breaking Change Candidates

1. Upgrade min iOS version to 12

With the Xcode update, Flutter's minimum IOS support version has been upgraded to 12. This plugin should follow suit.

2. Upgrade min Android sdk version to 21

The min sdk version supported by this plugin is 21. However, the actual build.gradle is listed at 19.

minSdk 19

This is a result of putting off the breaking change. Currently, this plugin can be compiled with Android sdk 19. However, there is no guarantee that all features will work properly under sdk version 21, and we do not intend to support these in the future.
For more clarity, we should upgrade the minSdk in build.gradle to 21.

3. Rename hasAccess and requestAccess

The names hasPermission and requestPermission may be easier to understand.

Android: Failed to build unique file

Did you check the documentation and it did not help?

Overview

Hi!
I use Gal.putImageBytes() and it saves image as image.png. Everything was fine, until the image(32).png, meaning that image(31).png is created perfectly fine, but next one is not. I've tested it by deleting image(31).png and it worked fine again, but not after it. I'm testing on POCO F4 with android 13.

I'm not sure if one will encounter the same error on other devices. But please, consider adding a String name = 'image.png' as a putImageBytes() paramater.

Steps to reproduce

  1. Save any Uint8List image using Gal.putImageBytes
  2. Repeat 31 times
  3. Bug occures

Code sample

Code sample
  Future<void> _saveImage(Uint8List screenshot) async {
    try {
      await Gal.putImageBytes(screenshot);
      setState(() {
        _isSaving = false;
      });
    } catch (e) {
      log(e.toString());
      setState(() {
        _isSaving = false;
      });
    }
  }

Environment

Logs
[✓] Flutter (Channel stable, 3.16.3, on Ubuntu 22.04.3 LTS 6.5.0-14-generic, locale ru_RU.UTF-8)
    • Flutter version 3.16.3 on channel stable at /home/lo4d/.puro/envs/stable/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0366e0a3f (7 недель назад), 2023-12-05 19:46:39 -0800
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/lo4d/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/lo4d/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.2
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)

[✓] Android Studio (version 2023.1)
    • Android Studio at /home/lo4d/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 77.1.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] Connected device (3 available)
    • 22021211RG (mobile) • 2e9e00b9 • android-arm64  • Android 13 (API 33)
    • Linux (desktop)     • linux    • linux-x64      • Ubuntu 22.04.3 LTS 6.5.0-14-generic
    • Chrome (web)        • chrome   • web-javascript • Google Chrome 120.0.6099.224

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Logs

Logs
PlatformException(UNEXPECTED, java.lang.IllegalStateException: Failed to build unique file: /storage/emulated/0/Pictures/image.png owner_package_name=net.removebackground.photoeditor.filterseffects _display_name=image.png mime_type=image/png _data=/storage/emulated/0/Pictures/image.png relative_path=Pictures/, android.os.Parcel.createExceptionOrNull(Parcel.java:3019)
android.os.Parcel.createException(Parcel.java:2995)
android.os.Parcel.readException(Parcel.java:2978)
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
android.content.ContentProviderProxy.insert(ContentProviderNative.java:557)
android.content.ContentResolver.insert(ContentResolver.java:2196)
android.content.ContentResolver.insert(ContentResolver.java:2157)
studio.midoridesign.gal.GalPlugin.writeData(GalPlugin.java:141)
studio.midoridesign.gal.GalPlugin.putMediaBytes(GalPlugin.java:132)
studio.midoridesign.gal.GalPlugin.lambda$onMethodCall$3$studio-midoridesign-gal-GalPlugin(GalPlugin.java:80)
studio.midoridesign.gal.GalPlugin$$ExternalSyntheticLambda2.run(Unknown Source:6)
java.lang.Thread.run(Thread.java:1012)
, null)

Consider add some functions to save incoming bytes stream directly to gallery

Proposal

As we discuss at #128, sometime we need to push directly incoming bytes stream to a file in gallery

For example:

// Download A Large Video Using Dio
File videoFile = Gal.getVideo('video.mp4',  album: '$album', createIfNotExist: true);
await Dio().download('$url', videoFile.path)

// Or Manual Controll Stream
File videoFile = Gal.getVideo('video.mp4',  album: '$album',  createIfNotExist: true);
IOSink videoSink = videoFile.openWrite();

response.stream.listen(
  (List<int> newBytes) async {
    videoSink.add(newBytes);
  },
  onDone: () async {
    await videoSink.flush();
  },
  onError: () {
    unawaited(videoSink.close().then((value) => videoFile.delete()));
  },
  cancelOnError: true,
);

Use case

If the file is large, it take more phone's resource to

download file to temp directory -> copy to gallery by using Gal.putVideo -> delete file in temp directory

Resource for proccessing that flow is too expensive if the downloading file is large. So, we need somehow to push incoming bytes stream to a file in gallery. And then the flow is just simple like

download file to gallery

Macos App is crashing when saving image/video from url/asset path

Did you check the documentation and it did not help?

Overview

Example app is crashing when saving any media in a macos app.

Launching lib/main.dart on macOS in debug mode...
Running pod install...
Building macOS application...
Debug service listening on ws://127.0.0.1:62949/agyoteWD9JI=/ws
Syncing files to device macOS...
Lost connection to device.
the Dart compiler exited unexpectedly.

Steps to reproduce

1 Run example app in intel mac
2 Press "Save Video from file path" button

Code sample

Code sample
[Paste your code here]

Environment

Logs
/Users/macpro/sdk/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.16.8, on macOS 13.4 22F66 darwin-x64, locale en-GB)
    • Flutter version 3.16.8 on channel stable at /Users/macpro/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67457e669f (3 weeks ago), 2024-01-16 16:22:29 -0800
    • Engine revision 6e2ea58a5c
    • Dart version 3.2.5
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/macpro/Library/Android/sdk
    • Platform android-34, build-tools 33.0.2
    • ANDROID_HOME = /Users/macpro/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.4 22F66 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
    • All expected network resources are available.

• No issues found!
Process finished with exit code 0

Logs

Logs
[Paste your logs here]

2.3.0 not compatible with gal_linux

Did you check the documentation and it did not help?

Overview

pub-cache/hosted/pub.dev/gal_linux-0.0.1/lib/src/gal_linux.dart:25:16: Error: The method 'GalPluginLinux.putImageBytes' has fewer named arguments than those of overridden method 'GalPlatform.putImageBytes'.
Future putImageBytes(Uint8List bytes, {String? album}) =>

pub-cache/hosted/pub.dev/gal-2.3.0/lib/src/gal_platform_interface.dart:23:16: Context: This is the overridden method ('putImageBytes').
Future putImageBytes(Uint8List bytes,

Steps to reproduce

when i upgrade to gal 2.3.0

Code sample

Code sample
flutter_quill

Environment

Logs
nothing

Logs

Logs
nothing

Retrieve saved image path after saving to Gallery

Did you check the documentation and it did not help?

Proposal

Hi. Great project! Currenty putImage and putImageBytes both return void after saving the image to gallery. I would like for the function to return the saved image path. I saw similar issue #203 but had no idea it was marked as completed, apologize if there is already a discussion that I may overlooked.

Use case

I would like my app to have function to open image directly quickly after saving.

Adding a name parameter in putImageBytes

Did you check the documentation and it did not help?

Proposal

I believe adding a 'name' parameter in putImageBytes method will enable developer to give custom names for any image to be saved in gallery.

Use case

I think having 'image' name for every saved image can cause confusion to the user. Especially for applications like collage maker where devs might prefer to save the image with collage name defined by user.

Getting new path of saved image

Hi all,

I couldn't find it, but how do i get the new path of the image? I am using the ImagePicker library to take the picture, however this library creates a file in the cache of the app directory. After i move it to the gallery i would like to delete the cached file and continue with the new path. How would one proceed with this?

Thanks!

App crash on permission request from a different plugin

Describe the bug
When using this plugin with geolocator plugin, if we call geolocator's Geolocator.requestPermission(), the app crashes:

Logs

E/AndroidRuntime( 4651): Process: <elided>, PID: 4651
E/AndroidRuntime( 4651): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=109, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {<elided>/io.flutter.embedding.android.FlutterActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.concurrent.CompletableFuture.complete(java.lang.Object)' on a null object reference
E/AndroidRuntime( 4651): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5526)
E/AndroidRuntime( 4651): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5565)
E/AndroidRuntime( 4651): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
E/AndroidRuntime( 4651): 	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime( 4651): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
E/AndroidRuntime( 4651): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
E/AndroidRuntime( 4651): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
E/AndroidRuntime( 4651): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 4651): 	at android.os.Looper.loopOnce(Looper.java:205)
E/AndroidRuntime( 4651): 	at android.os.Looper.loop(Looper.java:294)
E/AndroidRuntime( 4651): 	at android.app.ActivityThread.main(ActivityThread.java:8176)
E/AndroidRuntime( 4651): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4651): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime( 4651): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/AndroidRuntime( 4651): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.concurrent.CompletableFuture.complete(java.lang.Object)' on a null object reference
E/AndroidRuntime( 4651): 	at studio.midoridesign.gal.GalPlugin.onRequestPermissionsResult(GalPlugin.java:212)
E/AndroidRuntime( 4651): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:781)
E/AndroidRuntime( 4651): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult(FlutterEngineConnectionRegistry.java:413)
E/AndroidRuntime( 4651): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult(FlutterActivityAndFragmentDelegate.java:820)
E/AndroidRuntime( 4651): 	at io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:941)
E/AndroidRuntime( 4651): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:9089)
E/AndroidRuntime( 4651): 	at android.app.Activity.dispatchActivityResult(Activity.java:8947)
E/AndroidRuntime( 4651): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5519)
E/AndroidRuntime( 4651): 	... 13 more
I/Process ( 4651): Sending signal. PID: 4651 SIG: 9

Smartphone (Optional):

  • Device: Pixel 6 Pro (emulator)
  • OS: Android 14

Remove plugin_platform_interface

Until now, gal had postponed adopting a federated plugin implementation, as a substantial redesign would be necessary if adopted. However, with Dart 3's base modifier, this package has become unnecessary except when creating mocks. In Gal's testing, the integration tests completely cover the code without the need for mocks. Therefore, the plugin_platform_interface package has been removed.

see: a-note-about-base

Can't compile for windows in lower than C++ 20

Did you check the documentation and it did not help?

Overview

I'm using Visual Studio Community 2022 17.8.3 with MSVC v143.
Additionally, is there a particular reason for adopting C++20? It could potentially limit the package's usability due to compatibility issues.

Steps to reproduce

Just run the sample

Code sample

Code sample
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
}

Environment

Logs
[√] Flutter (Channel stable, 3.16.3, on Microsoft Windows [Version 10.0.19045.3803], locale en-US)
    • Flutter version 3.16.3 on channel stable at V:\Env\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0366e0a3f (2 weeks ago), 2023-12-05 19:46:39 -0800
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Admin\AppData\Local\Android\sdk
    • Platform android-33, build-tools 30.0.3
    • Java binary at: V:\JetBrains\apps\AndroidStudio\ch-0\222.4459.24.2221.10121639\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)
    • Visual Studio at V:\02_Apps\Microsoft Visual Studio
    • Visual Studio Community 2022 version 17.8.34330.188
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.3)
    • Android Studio at V:\JetBrains\apps\AndroidStudio\ch-0\213.7172.25.2113.9014738
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[!] Android Studio (version unknown)
    • Android Studio at V:\JetBrains\apps\AndroidStudio\ch-0\222.4459.24.2221.10121639
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    X Unable to determine Android Studio version.
    • android-studio-dir = V:\JetBrains\apps\AndroidStudio\ch-0\222.4459.24.2221.10121639
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] IntelliJ IDEA Ultimate Edition (version 2022.1)
    • IntelliJ at V:\JetBrains\apps\IDEA-U\ch-0\221.5080.210
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.3803]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 120.0.6099.71
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 120.0.2210.77

[√] Network resources
    • All expected network resources are available.

Logs

Logs
CMake Deprecation Warning at V:/01_Work/Projects/myproject/build/windows/x64/extracted/firebase_cpp_sdk_windows/CMakeLists.txt:17 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
2

Nuget.exe not found, trying to download or use cached version.
Nuget.exe not found, trying to download or use cached version.
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\impl\Windows.Foundation.0.h(983,26): error C2039: 'wait_for': is not a member of 'winrt::impl' [V:\01_Work\Projects\myproject\build\windows\x64\plugins\gal\gal_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\impl\Windows.Foundation.0.h(1004,26): error C2039: 'wait_for': is not a member of 'winrt::impl' [V:\01_Work\Projects\myproject\build\windows\x64\plugins\gal\gal_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\impl\Windows.Foundation.0.h(1038,26): error C2039: 'wait_for': is not a member of 'winrt::impl' [V:\01_Work\Projects\myproject\build\windows\x64\plugins\gal\gal_plugin.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt\winrt\impl\Windows.Foundation.0.h(1057,26): error C2039: 'wait_for': is not a member of 'winrt::impl' [V:\01_Work\Projects\myproject\build\windows\x64\plugins\gal\gal_plugin.vcxproj]
Exception: Build process failed.

Exited (1).

[REQUEST] Add ability to save media files from bytes (Uint8List)

Problem this request is trying to solve
Hi. Today I started looking at packages for saving media files to the device gallery app and found this package very clean, maintained, and useful for this purpose.

However, in order to save a media file that is on Memory (as bytes), I should do this: write to a temporary directory, then export to the gallery app.

Screenshot 2023-07-03 at 19 11 47

Would you consider if I open a PR for this built-in feature which will require path_provider package as a dependency?

Is there a way to add an existing file to Gallary?

Discussed in #128

Originally posted by ngotandatnnst August 29, 2023
Your plugin is clearer and better same plugins I have used

But I finding a plugin which allow me to just add a existing file (image/video) to gallary without copy and paste to gallary

I have read your code at function writeData in /main/android/src/main/java/studio/midoridesign/gal/GalPlugin.java file. It like copy and paste an existing file to gallary. It will make a file duplicated to 2, one at original path and one at new gallary path. But your plugin can do better by allow dev just tell that "add this filepath to gallary for end user can find it in Gallary app without move or copy it"

If I understand wrong, please correct me. I've only been learning Flutter for a few months

An unexpected error has occurred while saving the webp format.

Did you check the documentation and it did not help?

Overview

An error occurred while writing HEIC or WebP format images to the album.

Steps to reproduce

  1. Compressing images and setting the output format to Heic or webp using FlutterImageCompress

  2. Storing images to the phone album using Gal

  3. Gal error: An unexpected error has occurred.

Everything works fine when the output format is jpg or png.

Code sample

Code sample
      final result = await FlutterImageCompress.compressWithFile(
          file.absolute.path,
          minWidth: image.width,
          minHeight: image.height,
          quality: quality,
          keepExif: keepExif,
          format: CompressFormat.webp);

      if (result == null) {
        continue;
      }

      final hasAccess = await Gallery.shared.requestAccess();
      if (!hasAccess) {
        return;
      }
      try {
        await Gallery.shared.putImageBytes(result);
        HUD.showToast("Saved.");
        HUD.dismissDialog();
      } on GalException catch (e) {
        HUD.showToast(e.type.message);
        HUD.dismissDialog();
      } catch (e) {
        HUD.showToast(e.toString());
        HUD.dismissDialog();
      }

Environment

Logs
[✓] Flutter (Channel stable, 3.19.3, on macOS 13.6 22G120 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.19.3 on channel stable at /opt/homebrew/Caskroom/flutter/3.16.5/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (7 days ago), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart version 3.3.1
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/joe/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A240d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554             • android-arm64  • Android 13 (API 33) (emulator)
    • Joe (mobile)                • 00008110-001670882E42801E • ios            • iOS 17.1 21B74
    • macOS (desktop)             • macos                     • darwin-arm64   • macOS 13.6 22G120 darwin-arm64
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 122.0.6261.129

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Logs

Logs
An unexpected error has occurred.

Unsupported file formats Error for existed files

Did you check the documentation and it did not help?

Overview

after converting the files using FFmpeg ... the generated files can be accessed and run without any problems through the file manager. but when I use Gal to display it inside the gallery, I get an Unsupported file formats error.

Steps to reproduce

  1. add FFmpeg package ffmpeg_kit_flutter_full_gpl: '6.0.3-LTS
  2. add filesystem_picker: ^3.1.0 to pick file from system
  3. gal: ^2.1.2
  4. convert a picked video to formats like mp4, avi, mkv, and ...
  5. after the converting process done
  6. check the converted video from File Manager for sure if it is done successfully
  7. save the converted video to the gallery using Gal
  8. geting error Unsupported file formats

Code sample

Code sample
String selectedFilePath =
        '/data/user/0/com.test.fmkr/cache/file_picker/VID_20230428_140439.mp4';
    String outputPath =
        ' /storage/emulated/0/Movies/fmkr/VID_20230428_140439_2023101818313.avi';

    // convert mp4 to avi format
    FFmpegKit.executeAsync(
      '-i $selectedFilePath -c:v libx264 -c:a aac $outputPath',
      (Session session) async {
        final returnCode = await session.getReturnCode();

        if (ReturnCode.isSuccess(returnCode) == true) {
          Gal.putVideo(outputPath);
        }
      },
    );

Environment

Logs
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.1, on Manjaro Linux 5.15.125-1-MANJARO, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.3)
[✓] Connected device (3 available)
[☠] Network resources (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ Exception: Network resources exceeded maximum allowed duration of 0:04:30.000000

! Doctor found issues in 1 category.

Logs

Logs
E/flutter ( 5527): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [GalException/NOT_SUPPORTED_FORMAT]: Unsupported file formats.
E/flutter ( 5527): #0      GalPlatform._invokeMethod (package:gal/src/gal_platform.dart:17:7)
E/flutter ( 5527): <asynchronous suspension>
E/flutter ( 5527): #1      GalPlatform.putVideo (package:gal/src/gal_platform.dart:24:5)
E/flutter ( 5527): <asynchronous suspension>
E/flutter ( 5527): #2      ConvertingCubit.saveOnGallery (package:fmkr/controller/converting/converting_cubit.dart:158:5)

Warning: The plugin gal requires Android SDK version 34.

Did you check the documentation and it did not help?

Overview

When running the example app using Flutter 3.16.9 (latest stable) I get the following warning.

Launching lib/main.dart on Pixel 6 in debug mode...
Warning: The plugin gal requires Android SDK version 34.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to /Users/chriswickens/clone/gal/example/android/app/build.gradle:
android {
  compileSdkVersion 34
  ...
}

✓  Built build/app/outputs/flutter-apk/app-debug.apk.

The app still compiles and the example app appears to work as expected. I just wanted to check whether anyone else is getting this or has more information as I couldn't find an existing issue. I'm also getting this warning when importing the package into my own project.

Steps to reproduce

  1. Run the example app on an Android device (I'm on a Pixel 6 running Android 14 beta)
  2. See warning in the debug console

Code sample

See the example app

Environment

Logs
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.3 23D56 darwin-arm64, locale en-GB)
    • Flutter version 3.16.9 on channel stable at /Users/chriswickens/.asdf/installs/flutter/3.16.9-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (3 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/chriswickens/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.86.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0

[✓] Connected device (5 available)
    • Pixel 6 (mobile)            • 1A141FDF6009JM                       • android-arm64  • Android 14 (API 34)
    • Christopher’s iPad (mobile) • 00008103-001438D221D1001E            • ios            • iOS 17.4 21E5195e
    • iPhone 15 Pro (mobile)      • 7AFF6F91-5095-4290-AAF7-4271825620E2 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 14.3 23D56 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
    • All expected network resources are available.

Logs

Logs
[Paste your logs here]

Allow building macOS apps targeting 10.14 or 10.15 macOS version

Proposal

gal requires macOS 11 (Big Sur) in order for the gallery saving to work at all. If Xcode project targets lower version (e.g. 10.14 or 10.15), then the project doesn't build. I suggest, if possible, allowing usage of gal on macOS targets lower than 11.0, and instead throw UnsupportedError, if gallery saving is not available. I wonder, whether .swift files will build at all, yet I see #available(iOS 14, macOS 11, *) directives in the source code, which my hope is based on.

Perhaps Gal.isSupported() might be added to know, whether gal is available (may include Linux and Web to that indicator, which are not supported by gal). It might be better, than adding conditions by the developer, as it wouldn't require checking whether the package updates to support the platform.

Use case

The primary reason of allowing lower macOS versions to run is simply the users base. According to market share, 3% to 5% of macOS in the world still are running 10.14 Mojave (perhaps a bit more running 10.15 Catalina). And Flutter supports macOS 10.14+.

Many of my android users report me this error - An unexpected error has occurred

Descrpition

I use gal 2.2.0 with flutter 3.16.4
I use gal to save photos downloaded from the internet. I have tried my app on several different phones and it works nicely. Unfortunately, at least 3 of my users experience this error "An unexpected error has occurred"

Here is my code:

await Gal.requestAccess(toAlbum: true);
final uri = Uri.parse(image_url);
final extension = path.extension(uri.path);
final filePath = '${Directory.systemTemp.path}/file.$extension';
await Dio().download(sending.image, filePath);
try {
  await Gal.putImage(filePath, album: "Familink");
  Fluttertoast.cancel();
  if (!context.mounted) return;
  Fluttertoast.showToast(
      msg: S.of(context).saved,
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.CENTER,
      timeInSecForIosWeb: 1,
      fontSize: 16.0);
  break;
} on GalException catch (e) {
  Fluttertoast.cancel();
  if (!context.mounted) return;
  Fluttertoast.showToast(
      msg: e.type.message,
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.CENTER,
      timeInSecForIosWeb: 1,
      fontSize: 16.0);
  break;

I have no idea how to debug this

Support AGP 8

Overview

When trying to build an APK with Flutter 3.13, compile sdk 34 (Android 14) and AGP 8, there's an error:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':gal'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

     android {
         namespace 'com.example.namespace'
     }

     If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@774edada of type BuildFlowService.Parameters
   > A problem occurred configuring project ':gal'.
      > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
         > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:

           android {
               namespace 'com.example.namespace'
           }

           If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 1s

Code sample

Example app

Environment

  • Android Emulator (SDK 34)
  • Flutter 3,13
  • Compile SDK 34, AGP 8
  • Plugin version 1.8.6

Logs

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.