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
2
votes
3 answers

rxdart usage in Flutter not being recognized

I am trying to use rxdart package for the first time in my Flutter app and I have added the package in yaml file, then I saved it and vscode automatically ran flutter packages get on project after that complete I tried to import the package with…
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75
2
votes
1 answer

List' is not a subtype of type 'List' in type cast

I am trying to create dynamic drop down, whose values are populating from one of the lookup table using micro-services, but i have tried same in many ways till now i have not succeed for making it work. as i am totally new to dart/flutter So can…
sidd shadab
  • 123
  • 1
  • 11
2
votes
1 answer

How use native libraries in flutter?

I want to be able to use a native library for example GLIDE in my flutter android project. I have included gradle in the folder android/app/build.gradle dependencies { implementation fileTree(include: '*.aar', dir: 'libs') …
2
votes
0 answers

Notifications not shown when the app is active or closed

Device Info:Xiomi Redmi 4 Android: 7.1.2 N2G47H MIUI: 9.1.1.0 When using these plugins : Scheduled Notifications, Local Notifications, Firebase Cloud Messaging, notifications work correctly. But there are a few cases where notifications are not…
Rajesh
  • 3,562
  • 7
  • 24
  • 43
2
votes
4 answers

How to extract location name from lat and lon

I have extracted longitude and latitude using geolocation plugin in flutter. But now I need to create name of place from those longitude and latitude. I tried using geocoder plugin, but final coordinates = new Coordinates(latitude, longitude); …
Neeraj Yadav
  • 422
  • 6
  • 13
2
votes
1 answer

Flutter: Firebase Pushnotification On Data Change

After getting the comment, i have deployed this folowing code to my firebase project and it was successfully deploed!.But there is no notifications been send to me. Please check my Firebase Realtime database Screenshot here for better understanding.…
Rajesh
  • 3,562
  • 7
  • 24
  • 43
2
votes
3 answers

Package cloud_firestore has no versions that match >=0.7.0 <0.8.0 derived from

I'm trying to get the cloud_firestore package, which is required for this flutter tutorial: https://codelabs.developers.google.com/codelabs/flutter-firebase/#7 when I run flutter packages get I only get back: Package cloud_firestore has no versions…
2
votes
1 answer

Dart cannot read readAsStringSync

I am using Dart VM version: 1.24.3 (Wed Dec 13 23:26:59 2017) on "macos_x64" WITH Flutter 0.2.8 • channel beta Framework • revision b397406561 (13 days ago) Engine • revision c903c217a1 Tools • Dart 2.0.0-dev.43.0.flutter-52afcba357 ReadAsStringSync…
2
votes
1 answer

Unable to find bundled Java version when installing flutter

Unable to find bundled Java version when installing flutter.
Qusay Saad
  • 279
  • 1
  • 5
  • 12
2
votes
3 answers

Flutter Xcode build failure after adding 1st-party dependency

While building an app using Android Studio with the Flutter SDK I decided to get the shared_preferences plugin and play around with it. Soon after, I noticed that although the app was running fine on my Android device, it wouldn't build to run on…
Nathan Bird
  • 910
  • 1
  • 9
  • 23
1
vote
0 answers

how to make a UI like design , here i want to add emojis dynamically according to data , if data value is 4 then only display 4 emojis like that

how can i achieve this i am new to flutter , please help. is there any library for achieving this?. class MoodMeter extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( …
1
vote
0 answers

Flutter: Android Gradle plugin mismatch when trying to upgrade

I'm trying to upgrade my current flutter project to use the latest flutter sdk. Currently my project is using 3.7.x, I'm trying to upgrade to be able to use 3.13.x. Besides that, currently there are many old packages in the project. So I'm upgrading…
1
vote
0 answers

How to center the focus on double tap zoom in Flutter's PhotoView?

I am using the PhotoView library in a Flutter project to allow users to enlarge images. Everything works fine, but I have a special requirement. When the user double taps on a portion of the image to zoom in, I want the tapped portion to be centered…
1
vote
1 answer

How to change color of dates in table_calendar Flutter package?

I was searching for how to change color of dates in Flutter, and couldn't end up with any solution. ChatGPT says its not even possible? :( Does anyone here know how to do that?
Elle Bishop
  • 307
  • 11
1
vote
1 answer

Flutter RiverPod StateProvider with auto dispose not disposing the updated value when navigate to next screen

I am using StateProvider with bool value false and update it to true on button Click and move to next screen and use same StateProvider on new screen but StateProvider contains the value as true instead of default value which is false. final…
Sunil
  • 143
  • 1
  • 2
  • 11