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
1 answer

Is there a way to import a flutter package for a specific platform?

I want to use a plugin on my flutter app, but since it doesn't works as spected on Android but it does on Ios, I want to use it only on Ios for a while. Is there a way to import a package only for Ios platform?
1
vote
2 answers

i am getting error on The lower bound of "sdk: '>=2.11.0 <3.0.0'" must be 2.12.0' or higher to enable null safety. and red lines on flat button,

Today, I got a job after struggling so much, Now they asked me to clone a project from master file and run the project, from past two days i ma trying hard to run the project but i am getting errors like in whole project i am getting error on…
1
vote
0 answers

Save SQLITE database in download folder and use database

I save my database in the folder /storage/emulated/0/Download/Database. Initially, the database functions properly. However, when I uninstall and then reinstall the application, I encounter an error while attempting to access the database:…
VDTe
  • 438
  • 1
  • 4
  • 17
1
vote
1 answer

instagram and facebook videos not downloading using flutter_downloader

I am making a Flutter video download manager. I am using flutter_downloader plugin. But the problem being faced is that either video is not downloading or it is not playing if downloaded. Below is the code to download the video from Facebook and…
1
vote
1 answer

Unhandled Exception: PlatformException(AndroidAudioError, setDataSource failed., java.io.IOException: setDataSource failed

I am new to flutter and currently learning flutter basics from tutorials online. I am currently building a simple app in which we can play an audio from our assets when TextButton is pressed. I have used audioplayers library for the same. I am…
1
vote
0 answers

Redirection to link in webview_flutter: ^4.2.1 is not working in android build

Redirection to a link in side webview of webview_flutter: ^4.2.1 is not working on android build but its working fine on Ipad and Iphone here Is the controller i have used controller.setJavaScriptMode(JavaScriptMode.unrestricted); …
1
vote
0 answers

Unhandled exception: Exception: Cannot find the executable for `where`

I'm installing Flutter to develop apps on Windows 10. I accidentally deleted the environment variable, but I recovered its path through the terminal with the echo %PATH% command. After that, I entered the corresponding path to the \bin folder in the…
1
vote
0 answers

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) #0 PathProviderApi.getDirectoryPath

I am getting the following exception while running flutter on ios emulator. the app is initialized but the screen is blank. when running on android it works - the exception is only on ios. Unhandled Exception: PlatformException(channel-error, Unable…
MM Gè
  • 11
  • 1
1
vote
1 answer

Flutter firebase_auth and firebase_core depency errors

I am trying to run my old project after updating flutter sdk to the latest 3.10, but I am getting this error my pubspec.yaml has the following dependencies dependencies: firebase_auth: firebase_core: intl: ^0.18.1 flutter_spinkit: ^5.1.0 …
1
vote
1 answer

Bad state: GetIt: Object/factory with type LoginViewModel is not registered inside GetIt

Bad state: GetIt: Object/factory with type LoginViewModel is not registered inside GetIt. (Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance; Did you forget to register it?) //THIS IS THE ERROR I GOT screenshot of…
1
vote
0 answers

Why does my flutter app crash when trying to upload an image on Mi phones using image_picker_plus?

I am Encountering an issue with Flutter upload image functionality. when I attempt to upload using Mi brand phones, the camera abruptly shuts down and the application restarts. Currently, I am using the Redmi Note 7S, and this problem seems to be…
1
vote
0 answers

flutter and egrocer version conflict on git

since every version of flutter_paystack from git depends on intl ^0.17.0 and egrocer depends on intl ^0.18.0, flutter_paystack from git is forbidden. So, because egrocer depends on flutter_paystack from git, version solving failed. how to fix?? here…
1
vote
3 answers

flutter date time picker issue

/C:/Users/shivam%20bunkar/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker-1.5.1/lib/flutter_datetime_picker.dart:6:1: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and…
1
vote
1 answer

Flutter Rive animate after tap

I'm new using Rive and I want to use it in a proyect but I don't know very well how to animate it after tap, I'm using https://editor.rive.app/preview/2063-4080-flutter-puzzle-hack-project/381484?mode=animate&artboard=birb&animation=birb I tried…
Regnas01
  • 55
  • 1
  • 2
  • 10
1
vote
0 answers

How to get the Exif Metadata for the PDF document file in Flutter

With flutter_exif and native_exif lib, i got image file details but it doesn't return details of file format PDF.
Suganya
  • 419
  • 3
  • 11