FLUTTER ECOSYSTEM

Cleveroad/cr_file_saver

Cleveroad/cr_file_saver open-source repository details.

cr_file_saver のプロジェクト画像
Stars
3
Forks
11
最終プッシュ(UTC)
2024/02/21
プロジェクト状態
公開中
Cleveroad GitHub avatar
GITHUB Organization

Cleveroad ↗

Professional web and mobile development company. Full-cycle IT development!

言語KotlinDartJavaObjective-CSwiftRubyShell

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 5 件
  • flutter{"sdk":"flutter"}
  • plugin_platform_interface^2.1.2
  • flutter_test開発用{"sdk":"flutter"}
  • flutter_lints開発用^2.0.1
  • pigeon開発用^3.2.6

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

cr_file_saver

Header image

Cleveroad introduces file saver for Flutter

Features:
  • Request WriteExternalStoragePermission for Android if needed.
  • Save file to downloads directory on Android or Document folder on IOS.
  • Save file through standard file saving dialog.
Future features:
  • Saving file to a specific directory.

Setup

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  cr_file_saver: ^0.0.2
Android:

If you are using android 9 and below add this permission to project manifest:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
iOS:

Add permissions in ios folder, go to ios/Runner/info.plist and add next keys:

<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>

In your dart file add the following import:

import 'package:cr_file_saver/cr_file_saver.dart';

Usage

CRFileSaver has several static methods to work with:

  • requestWriteExternalStoragePermission to check for permission and ask it if needed.
  • saveFile simply saving file with provided file path and desired file name.
  • saveFileWithDialog save file through standard file saving dialog. Note that this method will throw NoResolvedActivityException if Android device has 30 api or higher