Questions tagged [dart-pub]

Pub is a package manager for Dart applications and libraries.

Pub is a package manager for Dart applications and libraries. You can find packages to use in a project or publish packages to the package repository. Pub automatically keeps track of dependencies to other packages and makes sure that the dependencies use the right version of a package.

Basics:

  • Use pub get to get dependencies
  • Use pub upgrade to upgrade a dependency
  • Use pub publish to make your library available for others

Resources:

1128 questions
4
votes
1 answer

How to set version constraints when depending on git packages using Flutter/Dart with versions below 1.0.0?

I am trying to set constraints for git package dependencies with versions below 1.0.0; however, it might also be versions above, but not sure. Flutter project depends on two packages that we're hosting on git repositories. We're referencing them in…
4
votes
2 answers

Invalid argument(s): Object/factory with type Api is already registered inside GetIt

When I try to launch my flutter app on an iOS emulator I get a white blank screen and this: Launching lib/main.dart on iPhone 12 Pro Max in debug mode... Running Xcode build... └─Compiling, linking…
Abdullah Hamadi
  • 161
  • 3
  • 10
4
votes
1 answer

Location spoofer breaks geolocator?

I'm using the geolocator package to get the current location of a device. I recently installed a location Spoofer app to test some features . However, upon using the spoofer, geolocator seems to break? It never returns a location whenever I try to…
Emmanuel
  • 315
  • 1
  • 3
  • 15
4
votes
2 answers

How to Convert current date to hebrew date in Flutter or Dart?

I want to Convert Current Date to Hebrew Date but didn't find any solution for it. Input 11 March 2021 Output 27 Adar 5781 I tried this package : https://pub.dev/packages/shamsi_date but didn't work for my solution.
4
votes
2 answers

Cannot run with sound null safety, because the following dependencies don't support null safety

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_platform_interface-2.2.0/lib/messages.dart:4:1: Error: A library can't opt out of null safety by default, when using sound null safety. // @dart =…
siva
  • 149
  • 1
  • 1
  • 11
4
votes
1 answer

Flutter Dart http2 how to add body to request

I just started learning flutter about 1 and half month ago. All the tutorials I found are in http1.1. We would like to use http2 for less latency. I'm trying to use http2 instead of http1.1 for a flutter application. import 'package:http/http.dart'…
nunuh89
  • 543
  • 1
  • 5
  • 11
4
votes
1 answer

How to set up a mirror/company-wide cache for Dart/Flutter packages?

Is there a way to set up a company-wide cache for pub.dev packages, without needing to mirror the entire pub.dev repo? I've seen there is a community-contributed pub_mirror package. But that one downloads the entire pub.dev, which is complete…
mreichelt
  • 12,359
  • 6
  • 56
  • 70
4
votes
2 answers

Flutter Default Image Placeholder

In my data i have posts, but some having image urls and others have false value, while displaying i want to show the placeholder where value are false Here is my code : child: FadeInImage( placeholder:…
4
votes
5 answers

How not to dismiss a PopUpMenuButton after selecting an item?

I am using flutter PopUpMenuButton. All i want is when i select any item on the menu, the popup should not be dismissed, rather let me select multiple values from the popup.The documentation says that you can override the handleTap property, but it…
Omi
  • 61
  • 1
  • 7
4
votes
2 answers

Getting "'context != null': is not true" error when trying to showDialogue after a MaterialPageRoute in Flutter?

I am currently able to MaterialRoute to a page from the Home App in Flutter, as well as show a popup dialogue. However, upon routing from that second page to a third page, which contains a button that is supposed to show a dialogue, I am receiving…
P_equals_NP_2021
  • 627
  • 1
  • 9
  • 27
4
votes
3 answers

Dart: How to map CSV data to a list of a model?

Let's say, In a file crops.csv, I have a simple dataset in a format like this: id,cropType,cropName 1,food,rice 2,cash,sugarcane 3,horticulture,orange And I have a Model Class named as foodCrops: class foodCrops { int id; String cropType; …
Shunjid Rahman
  • 409
  • 5
  • 17
4
votes
0 answers

How can use radial gauge in flutter?

I am trying to implement radial gauge in flutter. Syncfusion provides some exciting packages. But those are licensed. Can you recommend any of the packages with the same features?
afsal.an
  • 499
  • 2
  • 6
  • 13
4
votes
4 answers

Flutter: pub finished with exit code 255

I am making models for my flutter application via build runner,json model and json serializable. But i got this error Unhandled exception: RangeError (index): Invalid value: Valid value range is empty: 0 #0 _StringBase.[]…
Umair
  • 1,759
  • 6
  • 23
  • 44
4
votes
2 answers

How to change the cache duration of image cache in Flutter (packages: flutter_cached_network_image & flutter_cache_manager)

I have been trying to add a cache for images in flutter, but I haven't been able to set the cache duration. I have tried using the cached_network_image package, where I have a custom cache manager where I overwrite the cache duration to 2 minutes…
4
votes
4 answers

How to fix the error caused: pub get failed(69)

I'm having a problem to run the application for Flutter. pub get failed(69) I've tried using firebase_storage: any and firebase_storage: ^1.0.4 version: 1.0.0+1 environment: sdk: ">=2.1.0 <3.0.0" dependencies: flutter: sdk: flutter #…
Jibran Khatib
  • 57
  • 2
  • 8