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
58
votes
8 answers

Flutter App Running Error: Dart can not be opened, Developer can not be verified after upgrading to Catalina

I was using the latest version of Android Studio IDE for creating flutter apps. But when I upgraded from Mojave to Catalina and tried to open my flutter code on IDE it gave me an error saying: Dart can not be opened because the Developer can not…
54
votes
20 answers

How to solve "Unable to find git in your PATH" on Flutter?

I've just tried to install Flutter on Linux and when I try to run a flutter command (flutter doctor), I'm getting Error: Unable to find git in your PATH. How can I solve this?
Nikolay Shindarov
  • 1,616
  • 2
  • 18
  • 25
53
votes
13 answers

Flutter Firebase and Android issue - unable to initialise. Cannot find google-services.json with latest (sept 2020) migration instructions executed

I'm a Flutter developer and for the past two days I have been trying to get my app working for Android. It's quite a big app with a lot of different functionalities (mostly google maps and firebase) that work perfectly fine on iOS. However, now that…
51
votes
3 answers

Try using 'as prefix' for one of the imported directives,or hiding the name from all but one of the import

I have imported a Eosdart package which have action.dart file and even flutter have action.dart file so there is conflict which one should pick. please help in removing the conflict i have mentioned the error detail as a comment in code where i…
guruprakash gupta
  • 877
  • 4
  • 9
  • 15
50
votes
5 answers

Plugin project :location_web not found. Please update settings.gradle. How do I fix this?

I was using the google maps api and location pub,dev package in my android flutter app, and tried to bring up an image using the url from the api. This was the url with some code: class LocationHelper{ static String mapviewpointer({double…
47
votes
26 answers

Could not open settings generic class cache for settings file '

I reinstalled my android studio since the sdk was not found and so on. After re installing java jdk and android studio , everything worked well until I got an error saying 'Could not initialize class org.codehaus.groovy.runtime.InvokerHelper' which…
lorandsouza
  • 471
  • 1
  • 4
  • 3
42
votes
16 answers

No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider

My Flutter application is freezing on the splash screen and I'm getting the following error log: Built build\app\outputs\apk\debug\app-debug.apk. I/Choreographer(18870): Skipped 75 frames! The application may be doing too much work on its main…
Fabio Dias
  • 1,127
  • 2
  • 10
  • 11
39
votes
5 answers

This application cannot tree shake icons fonts

While trying to build my app in release mode I encountered the following the compiler error: "This application cannot tree shake icons fonts." terminal logs: flutter build ios --release Building com.xxx.xxx for device…
iven
  • 401
  • 1
  • 4
  • 6
38
votes
1 answer

Select branch in git dependency

Its possible to select some branch in the pubspec.yaml? library_sdk: git: url: git://github.com/library/library.git I need to use the develop branch instead master.
Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110
36
votes
13 answers

Flutter: Found this candidate, but the arguments don't match

I am working on a flutter app and project was running perfectly but suddenly project isn't running and it is giving me an error. Here is the error code i am getting when i try to run app Compiler…
36
votes
10 answers

How to remove or identify unused packages from flutter to reduce size of the project?

I used some packages that I no longer need in my flutter project, namely the wilddog_auth and wilddog_sync, I can remove the imports from pubspec.yaml file, and my dart files (aka removing import 'package:wilddog_sync/wilddog_sync.dart' etc.) and…
35
votes
9 answers

The plugins `XXXXX` use a deprecated version of the Android embedding

i was trying to get my dependences using pub get, but i keep getting a bunch off errors. And i'm stuck in these error. I have tried flutter clean, flutter upgrade and flutter doctor without any issue. Then i tried flutter pub cache repair witch…
Soto-kun
  • 371
  • 1
  • 3
  • 7
34
votes
10 answers

Error: PlatformException(no_fragment_activity, local_auth plugin requires activity to be a FragmentActivity., null)

Getting this error while using local_auth version 0.6.0 It's working fine for iOS but getting this error in android. Already have implemented class MainActivity: FlutterFragmentActivity() but still getting this issue
Devansh Vyas
  • 447
  • 1
  • 5
  • 8
33
votes
5 answers

How do I add an Example Project to a Flutter Package?

Is there a way to autogenerate template code for the example map structure in a package? Most packages have a /example folder within the package root that showcases the package functionality. I'm not sure what's the "best" way to create the…
Joel Broström
  • 3,530
  • 1
  • 34
  • 61
33
votes
4 answers

How can I put a widget above another widget in Flutter?

I would like to overlay a Round view on top of a background View just like in this screenshot below.