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

How to compare time in flutter?

here I want to validate time. as per this image, when I choose the Shift Begin time and End Time then whenever I am choosing break time it will always between Shift begin time and Shift end time. Here is the Image of output Here is the code for the…
2
votes
1 answer

getting error " getter 'year' was called on null " when clearing textfield in flutter

here when I click on the clear button it will not clear the all the textbox only clearing the expiry_date field only and also showing me the exception "getter year was called on null". in this code I have a clear button when I click on that button…
Rutvik Gumasana
  • 1,458
  • 11
  • 42
  • 66
2
votes
2 answers

Flutter | Dio Package ... downloading Large Files in Background

I am using flutter with dio package to download files like powerpoint and videos ...etc what i want to ask is how to download large file in background try { await dio.download( fileURL, '$dir/$fileName.pptx', onReceiveProgress:…
Ammar Al-Wazzan
  • 85
  • 1
  • 11
2
votes
2 answers

keep getting error "No implementation found for method getApplicationDocumentsDirectory"

I'm trying to use path_provider to save html files. Here is my function: Future createHtmlFile(String content) async { // Get the system temp directory. final directory = await getApplicationDocumentsDirectory(); var file =…
CryptoNight77
  • 377
  • 1
  • 2
  • 12
2
votes
0 answers

Keep alive page state while using navigator

I have an app with two pages , the first one has a button to navigate to the second and then choose a list of places, on save the second page pops and return the first page where the chosen places are shown in chips , but If a return to the second…
2
votes
1 answer

How to stop overwriting on the same file in flutter?

I want to save file seperately. I've used "Files.writeAsBytes(pdf.save())", But the problem is, it overwrites in the same file. savePDFfile(context) async { final String dir = (await getExternalStorageDirectory()).path; final String path =…
imgkl
  • 1,013
  • 1
  • 7
  • 24
2
votes
1 answer

Flutter web cannot use packages from mobile project

A few months ago I made an android application using flutter. The application requires various dependencies such as intl, cached network image, stopper, carousel_slider, etc. Then right now I want to convert the project to flutter_web. Here are the…
2
votes
1 answer

Flutter: How do i navigate to a new page after an image is picked with the ImagePicker plugin?

I'm using the Image Picker plugin to pick an image. I would like to navigate to a new screen immediately after an image is picked but it's not working. I'm getting an error that states that the context doesn't exist in the current widget tree. Below…
Tayo.dev
  • 1,546
  • 3
  • 21
  • 31
2
votes
1 answer

Conditionally Execute test() in Flutter

When using the Flutter test and drive options, can we control the execution of certain test based on the results from the previous ones ? We have a skip option in the test. However, I was unable to find anyway to check whether a previous test passed…
vzurd
  • 1,416
  • 2
  • 15
  • 37
2
votes
2 answers

Flutter build failed after adding dependency

Build fails after I've tried to install flutter_statusbarcolor package. Everything was ok before I did it, I am using Mac and XCode simulator. I just want to change color of status bar. This approach doesn't work. $ flutter run Launching…
mr.boris
  • 3,667
  • 8
  • 37
  • 70
2
votes
2 answers

Error running on iOS simulator with flutter

I am trying to set up flutter on Mac (macOS Sierra). I am trying to run one test application as per installation instruction I am getting an error as below === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug…
2
votes
2 answers

Is it a good practice to call setState method while using Bloc architecture in Flutter?

I'm using bloc architecture for my project, and I'm trying to disable/enable the form based upon the checkbox value. Here is my code->>> Widget _buildSameAsResidential(BuildContext context) { return StreamBuilder>( …
2
votes
2 answers

Flutter :- Inside the PageView Image is not setting to fit the screen on width?

I am using the PageView for the view-pager functionality and showing the image on each page with contains some text and button on each page. As I am using the Stack widget for putting the view on one another like Relative-layout in Android, But My…
Ravindra Kushwaha
  • 7,846
  • 14
  • 53
  • 103
2
votes
1 answer

Sending email with attachments via flutter_email_sender is not working on Android

I'm trying to send an email with a pdf attachment using flutter_email_sender, it works fine on iOS but throws Failed to find configured root error on Android. Below is the code. Future _downloadFile(String url, String filename) async { var…
2
votes
1 answer

Flutter Cloud Firestore errors after Flutter upgrade

With Flutter v1.9.1+hotfix.2 I get the below errors when attempting to build Android for release. Release build runs fine on device. iOS release build is fine. Flutter Doctor output and packages also listed below. I have tried multiple suggested…
Chris Herbst
  • 1,241
  • 1
  • 16
  • 28