lecle_flutter_absolute_path 0.0.2+1 copy "lecle_flutter_absolute_path: ^0.0.2+1" to clipboard
lecle_flutter_absolute_path: ^0.0.2+1 copied to clipboard

A Flutter project to get the absolute path of a file on Android or iOS device.

lecle_flutter_absolute_path #

A Flutter project to get the absolute path of a file on Android and iOS device.

Android #

Add these permission into your AndroidManifest file


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

iOS #

  • Add the following lines into your Info.plist.

<key>NSPhotoLibraryUsageDescription</key>
<string>Replace with your permission description.</string>

How to use #

  • Simply import lecle_flutter_absolute_path package on pub.dev or with the syntax below under dependencies in pubspec.yaml file and run flutter command flutter pub get in terminal

    dependencies:
    flutter:
    sdk:flutter

    lecle_flutter_absolute_path: <latest version>

  • Add the import below into your dart file

import 'package:lecle_flutter_absolute_path/lecle_flutter_absolute_path.dart';

Example #

  • Default use

String? filePath = await LecleFlutterAbsolutePath.getAbsolutePath(uri: 'your_file_uri');
  • Use with multi_image_picker (Old example, not recommend to use)

final filePath = await LecleFlutterAbsolutePath.getAbsolutePath(uri: asset.identifier);
  • Use with wechat_assets_picker

AssetPicker.pickAssets(context).then((assets) async {
  if (assets != null && assets.isNotEmpty) {
  for (var asset in assets) {
        final file = await asset.file;
        if (file != null) {
          final filePath = await LecleFlutterAbsolutePath.getAbsolutePath(uri: file.path);
          print('Absolute file path ::: $filePath');
        }
      }
    }
});
  • Use with image_picker

final filePath = await LecleFlutterAbsolutePath.getAbsolutePath(uri: asset.path);
7
likes
130
pub points
91%
popularity

Publisher

verified publisherlecle.vn

A Flutter project to get the absolute path of a file on Android or iOS device.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, path

More

Packages that depend on lecle_flutter_absolute_path