Flutter pubspec.yaml ,audioplayer not working - flutter

I started flutter these days. I'm trying to make an audio drum app.So I added the dependencies to file pubspec.yaml
audioplayers: ^0.19.1
But when I click 'pub get' I get this error.
Cannot create link, path = 'C:\src\flutter\flutter.pub-cache_temp\dir1b96d188\ios\Classes\AudioplayersPlugin.h' (OS Error: Required privilege is not provided by client.
, errno = 1314)
pub get failed (66; , errno = 1314))

Use audioplayers 0.20.1
Then go to .../android/buildgradle and change ext.kotlin_version to '1.4.32'
That worked for me.

Related

Flutter-Failed to build build_runner:build_runner on modularization

Describe my issue, i have modularization project so will be have different pubspec.yaml, every pubspec i use package for testing :
mockito: ^5.0.8
build_runner: ^2.0.4
dependency_overrides:
analyzer: ^1.7.0
so after generate flutter pub run build_runner build --delete-conflicting-outputs i get issue's, then i search google i it this cause analyzer, then i follow step to change analyze version, still error, in this error :
(base) dendimuhmd#macbook-pro datasources % flutter pub run build_runner build
Changing current working directory to: /Users/dendimuhmd/Documents/dev/flutter/dicoding/creative-movie/core
Failed to build build_runner:build_runner:
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/resolver.dart:18:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';
^
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/analysis_driver.dart:9:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';
^
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/build_asset_uri_resolver.dart:11:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';......
what is issue with analyzer, it this cause analyzer or?
Modularization structure

Trying to do a flutter pub get and got Process finished with exit code 66

Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Process finished with exit code 66
/Users/H025712/development/flutter/bin/flutter --no-color pub get
Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Cause: Someone in your team (could be yourself) add a plugin from their local folder. This plugin can't be found when you try to update the dependency.
Quick fix: If you use remote git, let you teammate include that plugin in the project folder, modify the pubspec.yaml path, add it to stage, commit then push. In the case not using git remote, copy those files to your computer in the path as pub spec.yaml suggested.
Ideal fix: Let your teammate use public plugin or share that plugin in private with password, then let flutter download that plugin by flutter pub get/upgrade.
Check your pubspec.yaml is well ordered, I had badly composed dev_dependencies and it failed me
Talked to my tech lead, who is familiar with the code; he said to check out the missing code that was referencing overrides in the pubspec.yaml:
https://dart.dev/tools/pub/dependencies
Dependency overrides
You can use dependency_overrides to temporarily override all references to a dependency.
For example, perhaps you are updating a local copy of transmogrify, a
published library package. Transmogrify is used by other packages in
your dependency graph, but you don’t want to clone each package
locally and change each pubspec to test your local copy of
transmogrify.
In this situation, you can override the dependency using
dependency_overrides to specify the directory holding the local copy
of the package.
The pubspec would look something like the following:
name: my_app
dependencies:
transmogrify: ^1.2.0
dependency_overrides:
transmogrify:
path: ../transmogrify_patch/

I add audioplayers 0.19.1 package from pub dev but when I run pub get, I face the Error , Cannot create link, I don't know what happened

Here is the Error I face
Cannot create link, path = 'C:\flutter\.pub cache\_temp\dir627f91b4\ios\Classes\AudioplayersPlugin.h' (OS Error: A required privilege is not held by the client.
, errno = 1314)
pub get failed (66; , errno = 1314))
This problem happens for permission issue. So you just need to run Command Prompt in administrator and then type
cd folderpath
after that you can run pub get
pub get
This will be fix your problem
running "vs code" (or what ever the IDE you use). run as admin solved my problem. and do what you always do in the terminal run command: flutter pub get
Audioplayers have been depricated use just_audio

flutter 'file not found' during build for ios

I'm trying to use the image_picker_web package,(https://pub.dev/packages/image_picker_web) and have put:
image_picker_web: ^1.0.9
in my pubspec.yaml file.
When I try building my project for iOS, I get the following error:
[ios/.symlinks/plugins/image_picker_web/example] flutter pub get
Running "flutter pub get" in example...
Cannot open file, path = '/Users/username/.pub-cache/global_packages/image_picker_web_example/pubspec.lock' (OS Error: No such file or directory, errno = 2)
pub get failed (66; Cannot open file, path = '/Users/username/.pub-cache/global_packages/image_picker_web_example/pubspec.lock' (OS Error: No such file or directory, errno = 2))
exit code 66
With no other code in the project that uses that package, I get the same error. The only way to avoid it is to comment out image_picker_web: ^1.0.9 in my pubspec.yaml and run 'flutter pub get'
I created an issue in their git repo, under the assumption that it's a bug. Is this the case? Are there any workarounds? (perhaps ignoring a package when building for a different platform?)
I ran the following command to fix a similar issue.
Remove all existing caches
sudo rm -rf ~/.pub-cache
Repair the cache
flutter pub cache repair
Reinstall the dependencies
flutter packages get

Error on locating local flutter package in another folder

i created a flutter package using the command
flutter create --template=package my_query
And it works fine, now i wanna use this package on my other application.
I added my package on the dependecies and also the path
dependencies:
flutter:
sdk: flutter
my_new_package:
path: ./Users/Name/Desktop/Flutter/my_query
error message:
pub get failed (66; Because flutter_email depends on couch_db from path
which doesn't exist (could not find package couch_db at
"‪./Users/Name/Desktop/Flutter/my_query"), version solving failed.)
exit code 66
This is the directory of my package
C:\Users\Name\Desktop\Flutter\my_query
How to do the path correctly?
try to set the path to your package in relation to the location of your pubspec.yaml file.
E.g. if your folder flutter-projects contains a folder with flutter-app and your package my-query, try referencing my-query in your pubspec.yaml like this:
dependencies:
my-query:
path: ../my-query
Let me know if this solved your issue!