Questions tagged [flutter-dependencies]

For questions relating to the use of and issues with any use of flutter-specific dependencies in dart's pubspec.yaml

Dependencies are one of the core concepts of the pub package manager. A dependency is another package that your package needs in order to work. Dependencies are specified in your pubspec. You list only immediate dependencies — the software that your package uses directly. Pub handles transitive dependencies for you.

For each dependency, you specify the name of the package you depend on and the range of versions of that package that you allow. You can also specify the source, which tells pub how to locate the package, and any additional description that the source needs to find the package.

Here is an example of specifying a dependency:

dependencies:
  transmogrify: ^1.0.0

This YAML code creates a dependency on the transmogrify package using the default source (pub.dev) and allowing any version from 1.0.0 to 2.0.0 (but not including 2.0.0). See the version constraints section of this page for syntax details.

If you want to specify a source, the syntax looks a bit different:

dependencies:
  transmogrify:
    hosted:
      name: transmogrify
      url: http://some-package-server.com
    version: ^1.0.0

This YAML code creates a dependency on the transmogrify package using the hosted source. Everything under the source key (here, just a map with a url: key) is the description that gets passed to the source. Each source has its own description format, which is described in the dependency sources section of this page. The version constraint is optional but recommended.

Use this long form when you don’t use the default source or when you have a complex description that you need to specify. But in most cases, you’ll just use the simple packagename: version form.

Dependency sources

Pub can use the following sources to locate packages:

SDK
Hosted packages
Git packages
Path packages
6510 questions
1
vote
0 answers

How to generate AppLocalization from .arb file

I download everything from the url and overwrite the .arb files with the data from the url. I want AppLocalization to be rebuilt for each language with new texts. I tried to create this function using intl , intl_translation and arbify but saw…
1
vote
1 answer

This binary was built with the incorrect architecture to run on this machine

enter image description here Please i need help in solving this. I enter "flutter doctor" in my terminal and expected to check if cocoapods has installed but show the result in image above.
Hemazyn
  • 11
  • 1
1
vote
1 answer

Flutter App that print message when headset button press by user

Can any one help me i used so many pub.dev package but i cannot find my answer I try on this packages audio_service 0.18.9 headset_connection_event flutter_headset_detector
RAM KUMAR
  • 13
  • 2
1
vote
1 answer

Flutter app freezes at splash screen (java.lang.RuntimeException: Unable to start activity ComponentInfo)

I am currently releasing my APKs to the stores and I've encountered a problem where my app wouldn't go further than the splash screen. I initially thought that problems is in how overloaded main() function is but then i got logcat.txt from play…
1
vote
2 answers

Any initState() replacement present in the Provider ecosystem?

Question: I want to build my app using no stateful widgets and I have a necessity of using initState(). I would be grateful, if anyone from the community can help me with this challenge. Is there any replacement for the initState() function in the…
1
vote
0 answers

Flutter app throwing multiple errors when tried to run in virtual device(API 33)

I'm new to flutter and trying to run a template app on the emulator, however when I click run, the console output log shows multiple error. Output log Launching lib/main.dart on sdk gphone64 x86 64 in debug mode... Running Gradle task…
1
vote
3 answers

Explicitly reordering items of reorderableListView

I want to achieve the functionality along with animation of reorderableListView Widget when it is dragged and dropped but instead of dragging how could it be done explicitly by a button click? Expected Output : - This is what I have done , remove…
1
vote
2 answers

Unable to build app due to 'smart_auth' package

I am trying to run a flutter app I am writing on my device but when I try to run, I never get past the "assembleDebug" stage and get this message in the terminal: Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... FAILURE: Build failed…
1
vote
1 answer

E/flutter ( 2647): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Connection refused

I have this error while connecting to a MySQL database in PHP, but while trying it on my Postman, it works very well. E/flutter ( 2647): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Connection refused import…
Mohammed Malek
  • 164
  • 1
  • 9
1
vote
1 answer

Audio player in flutter Always throwing Exceptionns from The Source Of my Assets

i tried to play my audio i downloaded audioplayers dependecies in pubspec.yaml and i added my assets but the problem is whenever im trying to play the audşo it throws exceptiob because of the assets are in some files so it cant see it and says that…
1
vote
1 answer

While compiling an application from linux, the flutter_secure_storage package gives an error

While compiling an application from linux, the flutter_secure_storage package gives an error. Error:- Launching lib/main.dart on Linux in debug mode... main.dart:1 CMake Error at…
1
vote
1 answer

Connection reset by peer - Flutter http package

Infrequently I get Connection reset by peer error. As a result the the application continues to see circular progress bar and remains stuck there. I am using http package "http: ^0.13.5". Is there a way to handle this…
Saad Bashir
  • 4,341
  • 8
  • 30
  • 60
1
vote
1 answer

flutter image_picker app crash after select image

I'm using image picker and get this error after I select an image from gallery. E/AndroidRuntime( 1465): FATAL EXCEPTION: main E/AndroidRuntime( 1465): Process: com.hoeis.report_project, PID: 1465 E/AndroidRuntime( 1465):…
1
vote
1 answer

flutter_widget_from_html and better_player incompatible issue

So I was trying to add flutter_widget_from_html and better_player together in my flutter app but they are incompatible with each other. This was the error message: C:\srcc\flutter\bin\flutter.bat --no-color pub get Running "flutter pub get" in…
im_jm
  • 11
  • 3
1
vote
0 answers

Why does my call to the variable give wrong results in terms of data?

Compared to my previous question I managed to use the "points" variable but when I try to use it in a method it gives me a value of 0 and not that of the points the method in the CartModel int calculateTotal() { int totalPrice = 0; for (int i =…
sams
  • 43
  • 6