Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
910 stars 199 forks source link

How to display the last media captured ? filePath does not exist for MediaCapture #405

Closed lclalalalala closed 7 months ago

lclalalalala commented 7 months ago

I am new to flutter and app development. Please give me some help.

I just copied paste from the document

import 'package:flutter/cupertino.dart';
import 'package:camerawesome/camerawesome_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:better_open_file/better_open_file.dart';
CameraAwesomeBuilder.awesome(
  saveConfig: SaveConfig.photoAndVideo(),
  onMediaTap: (mediaCapture) {
    OpenFile.open(mediaCapture.filePath);
  },
)

And vscode shows that

The getter 'filePath' isn't defined for the type 'MediaCapture'.
Try importing the library that defines 'filePath', correcting the name to the name of an existing getter, or defining a getter or field named 'filePath'.dart[undefined_getter](https://dart.dev/diagnostics/undefined_getter) 

How can I get the path of last captured photo?

About your device

Brand Model OS
Apple iPhone 14 Pro 16.1

Your flutter version

camerawesome: 2.0.0-dev.1

Flutter 3.13.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision d211f42860 (3 weeks ago) • 2023-10-25 13:42:25 -0700 Engine • revision 0545f8705d Tools • Dart 3.1.5 • DevTools 2.25.0

lclalalalala commented 7 months ago

I find the right code in the examples. I tried it and works fine.

          onMediaTap: (mediaCapture) {
            // OpenFile.open(
            //   mediaCapture.captureRequest
            //       .when(single: (single) => single.file?.path),
            // );

Why is that commented and not in the document?

g-apparence commented 7 months ago

There was an issue with the upgrading version of gradle and this package. It has been recently resolved and this will be uncommented. Sorry for this

g-apparence commented 7 months ago

This has been fixed in last commits.