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
18
votes
5 answers

I am getting the following error on running flutter create my_appName: "my_appName" is not a valid Dart package name

I have tried upgrading flutter to the latest version. I am still getting the same error.
18
votes
8 answers

Flutter open whatsapp with text message

I want to open whatsapp from my Flutter application and send a specific text string. I'll select who I send it to when I'm in whatsapp. After making some research I came up with this: _launchWhatsapp() async { const url = "https://wa.me/?text=Hey…
Kitcc
  • 2,138
  • 4
  • 24
  • 42
18
votes
6 answers

Cannot access 'android.arch.lifecycle.LifecycleOwner' which is a supertype of 'com.ex.app.MainActivity'

I create a new flutter project in android studio then "open project" the android part of it, I met an error in MainActivity.kt however it builds successfully. My class pathes are: and finally my dependencies are: implementation…
18
votes
10 answers

fatal error: module 'firebase_core' not found

Just created a new flutter project, added google-services-info.plist file to iOS and added firebase_core to pubspec.yaml. Ran the project and got this error. Error: fatal error: module 'firebase_core' not found @import firebase_core; I have…
user12784286
  • 181
  • 1
  • 1
  • 3
18
votes
6 answers

Flutter increase height and width of Switch?

I creating game with single and two players. for selection i want slide look so i have tried with switch method but its look very small. how to increase height and width of switch? is there any way creating look like this is welcome? new…
17
votes
11 answers

How to solve the error FAILURE: Build failed with an exception. * Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

I'm trying to run the application in the android emulator but this error keeps popping. FAILURE: Build failed with an exception. * Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005 * What went wrong: Execution…
sserunjogi
  • 171
  • 1
  • 1
  • 3
17
votes
3 answers

Warning: Mapping new ns to old ns and emulator stopping abruptly

After upgrading to Arctic Fox , I am getting the following errors, even though the emulator is running but sometimes stopping abruptly. What is this error ? How can I get rid of this ? I am using the following as copied from cmd : >…
Debasis Sil
  • 551
  • 1
  • 6
  • 13
17
votes
4 answers

Flutter - How can I add a circular loading indicator to my button?

I have a Flutter code. instead of showing nothing when the submit button is clicked, I want to show the circular loading indicator when the button is clicked so to keep the user busy but I'm having a challenge to convert a tutorial I have that does…
17
votes
23 answers

No implementation found for method pickImage on channel plugins.flutter.io/image_picke

I am implementing image_picker in my app. That is not showing any warning or message but when I run it in Android simulator it shows me an error in console: [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No…
Code Hunter
  • 10,075
  • 23
  • 72
  • 102
17
votes
9 answers

Flutter not detecting Android SDK

I've been trying to get flutter to detect the Android SDK. flutter doctor returns PS I:\Projects\Flutter\fluttertest\flutterproject> flutter doctor -v [√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.16299.248], locale…
16
votes
9 answers

How to downgrade flutter version

I updated my flutter version by flutter upgrade --force command and now my project doesn't compile is there is a way to downgrade to old version (i dont know my old version number) please help me because this is my graduation project
iKaka
  • 201
  • 1
  • 3
  • 8
16
votes
6 answers

type 'String' is not a subtype of type 'Null' in get method flutter

I got this error: type 'String' is not a subtype of type 'Null' in get method flutter this is the get api function that i use Future> getServiceTypesa() async { final String url = 'https://test.com'; final client = new…
Abdullah
  • 325
  • 1
  • 6
  • 21
16
votes
9 answers

How to fix the problem of 'Object of type XXXXX is not registered inside GetIt' in flutter?

I am trying to use get_it in order to create a singleton object to be used. I do not wish to use multiple objects of API which is connecting to Firebase. The singleton object is that of Api call for firebase. I have used the following…
Arpit Bansal
  • 493
  • 1
  • 4
  • 15
16
votes
4 answers

How to listen to Phone Calls in flutter App?

I'll try to ask it in as simple a way as I can. If my app is running in foreground and, I get a phone call at that very moment, is there any way I can call a function/perform an operation when this happens? // My App is open at any random time call…
Aman Malhotra
  • 3,068
  • 2
  • 18
  • 28
16
votes
2 answers

Flow Layout in flutter example

i want to implement flow layout in flutter i found a class called FLOW in sdk but unable to find sample code on how to use it here is the layout i am trying to achieve
user3924438