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
912 stars 201 forks source link

Example Doesn't Work - camera_app package not found #302

Closed makebettertechtoday closed 1 year ago

makebettertechtoday commented 1 year ago

I create a new flutter app: flutter create flutter_cameraawesome

Add cameraawesome flutter pub add camerawesome

From https://pub.dev/packages/camerawesome/example paste in the example code into main.dart.

Add this package flutter pub add better_open_file

Try to add the camera_app package: flutter pub add camera_app

I receive the following error: Because flutter_cameraawesome depends on camera_app any which doesn't exist (could not find package camera_app at https://pub.dartlang.org), version solving failed. pub finished with exit code 65

If I do flutter run I get the following error:


Is there another way to handle `path` or to add the package?
PS C:\Users\marty\flutter\flutter_cameraawesome> flutter run
Multiple devices found:
Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.1413]
Chrome (web)      • chrome  • web-javascript • Google Chrome 111.0.5563.147
Edge (web)        • edge    • web-javascript • Microsoft Edge 111.0.1661.62
[1]: Windows (windows)
[2]: Chrome (chrome)
[3]: Edge (edge)
Please choose one (To quit, press "q/Q"): 2
Launching lib\main.dart on Chrome in debug mode...
Error: Couldn't resolve the package 'camera_app' in 'package:camera_app/utils/file_utils.dart'.
lib/main.dart:2:8: Error: Not found: 'package:camera_app/utils/file_utils.dart'
import 'package:camera_app/utils/file_utils.dart';
       ^
lib/main.dart:35:37: Error: The method 'path' isn't defined for the class 'CameraPage'.
 - 'CameraPage' is from 'package:flutter_cameraawesome/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'path'.
            photoPathBuilder: () => path(CaptureMode.photo),
                                    ^^^^
lib/main.dart:36:37: Error: The method 'path' isn't defined for the class 'CameraPage'.
 - 'CameraPage' is from 'package:flutter_cameraawesome/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing method, or defining a method named 'path'.
            videoPathBuilder: () => path(CaptureMode.video),
                                    ^^^^
Unhandled exception:
NoSuchMethodError: The getter 'path' was called on null.
Receiver: null
Tried calling: path
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:164:71)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:705:47)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:612:9)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
Waiting for connection from debug service on Chrome...             20.6s
Failed to compile application.
apalala-dev commented 1 year ago

camera_app is the example app that you can see in more details here. The error happens because you don't have the file file_utils.dart in your project (it's not part of the library, it's just an example). If you'd like, you can find it here. To learn how to use CamerAwesome, I suggest you take a look at the documentation.

I'm closing the issue since it's not really a bug, but feel free to keep commenting here if you can't make camerawesome work.