I have created a new flutter app and after adding cloud_firestore 0.13.0+1 it will not compile. No errors it just stops and removes the row of compile icons. An Analysing spinner revolves forever.
In pub.dev it says to "Migrate the plugin to the pubspec platforms manifest." unfortunately I have been unable to find out where that is or how to do it in the documents or StackOverflow. Please help.
According to documentation, the plugins you required need to be added under dependencies in to a pubsec.yaml file located in the root of your project.
dependencies:
cloud_firestore: ^0.13.0+1
After your plugins are added to pubsec.yaml, you can make use of those dependencies in your code by using imports.
import 'package:cloud_firestore/cloud_firestore.dart';
Related
I started fluttering a few days ago. I want to add "font awesome" to my project, but I can't. I searched but could not find the right answer. I finally got this guide, but it doesn't work either.
Adding a package dependency to an app
To add the package, css_colors, to an app:
Depend on it
Open the pubspec.yaml file located inside the app folder, and add css_colors: under dependencies.
Install it
From the terminal: Run flutter pub get.
OR
From Android Studio/IntelliJ: Click Packages get in the action ribbon at the top of pubspec.yaml.
Import it
Add a corresponding import statement in the Dart code.
4. Stop and restart the app, if necessary
If the package brings platform-specific code (Kotlin/Java for Android, Swift/Objective-C for iOS), that code must be built into your app. Hot reload and hot restart only update the Dart code, so a full restart of the app might be required to avoid errors like MissingPluginException when using the package.
In the dependencies: section of your pubspec.yaml, add the following line:
dependencies:
font_awesome_flutter:
Look here https://pub.dev/packages/font_awesome_flutter/install
It contain examples and instructions.
Steps also the same:
add the package name to dependencies section. It very important to keep the correct number of spaces in every line of pubspec.yaml, it has very sensitive format
in your case:
dependencies:
font_awesome_flutter: ^8.10.0
Click "Packeges get" in top right corner
Import the package into your dart code
in your case:
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Now your can use it in Icon widget
Icon(
FontAwesomeIcons.mars,
size:80.0)
I am trying to add AdMob ads to my Flutter app. For that, I tried using firebase_admob (^0.9.3+2) plugin but it's not working for me, it stuck at build.apk.
I am getting the output as :
Note: /home/abhishek/dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/android/src/main/java/io/flutter/plugins/firebaseadmob/AdRequestBuilderFactory.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
My dependency in pubspec.yml are :
dependencies:
flutter:
sdk: flutter
meta: ^1.1.8
platform: ^2.2.1
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
firebase_admob: ^0.9.3+2
Where am I doing wrong?
See if you can remove firebase_core: ^0.4.0+9 then exec flutter clean
Not sure if it is related or not, but I'm having problems adding dependencies:
Error: Could not resolve the package 'google_sign_in' in 'package:google_sign_in/google_sign_in.dart'.
lib/authsvc.dart:7:8: Error: Not found: 'package:google_sign_in/google_sign_in.dart'
import 'package:google_sign_in/google_sign_in.dart';
I'm able to add the dependency in the pubspec.yaml file, run 'pub get' and it says that it downloads fine. No errors are reported in the editor (i.e. it recognizes the new commands and doesn't flag them). However, when I try to compile/build it, I get the above error message. 'Pub get' worked fine until I upgraded to the latest version of Flutter (v. 1.17.3) before I believe I was on (v. 1.17.0).
To fix it, I hardcoded the path in the Dart_Packages.xml file.
(I'm not looking to troubleshoot further, just adding this in case it helps the developers identify the problem). Thanks!
for context I am currently following this exercise provided by flutter dev: https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1/#3
I use android studio on a Windows 10 profesional.
I have seen this issue across many different areas and I am continually unable to get the English_Words package to upload. I had even uploaded the file directly the .packages and had the import work, however, the functions and classes do not validate
This is the import from main.dart
This is the pubspec.yaml, with the dependency properly spelled out
I had navigated and manually put in the english_words dependency. However, then the methods would not engage, even when the import worked. Furthermore, when I did ''' -flutter packages get ''', the file was removed, even with the .yaml dependency spelled out.
I have done lots of the recommended things:
-flutter doctor
-deleting the pubspec.lock and upgrading/getting packages
-shutting down the virtualization and android studio
cupertino icon and english words must have have a spacing of 2 just like flutter
ex:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
english_words:^3.1.5
this is a YAML file so spacing have a special meaning. just correct it as i did in example enjoy.
I am new in flutter and I want to add Fast Android networking library to flutter dependencies and I don't know how to add, anyone, help me, please.
It is very simple to add a package in flutter dependencies. What you need to do is place it under the dependencies: inside the pubspec.yaml file.
So open the pubspec.yaml. You will find this file in root project folder of your flutter app. And do the following to add new dependencies/libraries:
dependencies:
flutter:
sdk: flutter
# dependencies come below here
example_dependency: ^3.2.0+1 // at the end is the version of the depenency
second_example_dependecy: any // 'any' for any version of the dependecy
To find or discover new libraries for flutter and dart to help you in building your app you can find flutter and dart packages here.
To add http package to your flutter project, from within a terminal at the project root, just type:
flutter pub add http
The latest stable version will be used.
For info on options take a look at https://dart.dev/tools/pub/cmd/pub-add
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 steps that I did:
clone github web flutter
I run the command "flutter packages pub global activate webdev"
Then I edited pubspec.yaml and I adjusted it to pubspec.yaml in the previous project (android project)
Here is the contents of pubspec.yaml on the web flutter project:
name: flutter_web.examples.hello_world
environment:
# You must be using Flutter> = 1.5.0 or Dart> = 2.3.0
sdk: '> = 2.3.0-dev.0.1 <3.0.0'
dependencies:
flutter_web: any
flutter_web_ui: any
stopper: ^ 1.0.1
dev_dependencies:
build_runner: ^ 1.4.0
build_web_compilers: ^ 2.0.0
dependency_overrides:
flutter_web:
git:
url: https://github.com/flutter/flutter_web
path: packages / flutter_web
flutter_web_ui:
git:
url: https://github.com/flutter/flutter_web
path: packages / flutter_web_ui
provider:
git:
url: https://github.com/kevmoo/provider
ref: flutter_web
When I run 'pub dev', an error occurs while resolving the package stopper. Then I tried to open github from the package stopper (https://github.com/aryzhov/flutter-stopper), after that I checked the files in the lib folder. There I found a file called stopper.dart. It turns out that in the file, still using
import 'package: flutter / material.dart';
So that makes my pubspec error. Because the code should be replaced with
import 'package: flutter_web / material.dart';
Therefore, I tried to outsmart the problem by removing the dependency stopper on pubspec.yaml, then I created a stopper.dart file manually, then I saved it in the lib/mypackages folder. After that, I import stopper.dart from the lib/mypackages folder (it's no longer through the package).
The package stopper is just one of the packages that I use on my Android project. Actually there are many other packages that have the same problem as the package stopper. The point is I have to create the package files manually, then I change "package: flutter / ..." to "package: flutter_web /" manually, then I can import them.
What I want to ask, is there a more elegant and simple way?
Hi the instruction you are following is from an old repository here. As you can see this is discontinued. You can find the informaiton in the REadme.
Instead you should follow the instructions in this page. Read it once carefully and I would suggest to keep a backup of your main project and work on a copy.
First you will have to enable the flutter-web using flutter config --enable-web.
Then you will have to run flutter create .