I created a new flutter project. This is my pubspec.yaml file:
name: app_name
description: App Name
version: 1.0.0+1
environment:
sdk: ">=2.16.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^7.3.1
flutter_localizations:
sdk: flutter
get_it: ^7.1.3
floor: ^1.2.0
flutter_speed_dial: ^5.0.0+1
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
flutter_launcher_icons: ^0.9.2
floor_generator: ^1.2.0
build_runner: ^2.1.2
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/logo.png"
flutter:
uses-material-design: true
module:
androidX: true
androidPackage: com.example.appname
iosBundleIdentifier: com.example.appname
When I run the following commands:
flutter pub get
pod init
pod install
The podfile is created, but only with the following contents:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Runner' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Runner
end
When I try to run the app, I get the following error:
The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation
Anyone knows how I can fix this?
First clear Derived data from preference and remove it from bin as well
then use following commands
flutter clean
flutter pub get
cd ios
pod install
pod update
As the title states I can run my app on ios simulator but when I attempt to deploy my app to the iphone through Xcode I get the error message
:-1: library not found for -lFirebaseCore
Any suggestions on what I might be doing wrong ? This is my pubspec.yaml
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
http: "^0.11.3+16"
crypto: any
validate: "^1.6.0"
json_annotation: ^0.2.4
image_picker: "^0.4.1"
firebase_messaging: ^2.1.0
device_info: ^0.2.1
location: ^1.4.1
cached_network_image: "^0.4.1"
mutex: #"^0.0.1"
logging: "^0.11.3+1"
uuid: ">=1.0.0"
web_socket_channel: ^1.0.9
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
json_serializable: ^0.5.2
Any suggestions are more than welcome. Thanks
I don't remember exactly, but you have to include either firebase_database or firebase_auth in pubspec.yaml. I'll make a test and update this later.
Try cd into the iOS folder of your flutter projects directory and run
pod install
I am very new to Flutter, and stuck at the following error:
package:http/http.dart That library is in a package that is not known.
Maybe you forgot to mention it in your pubspec.yaml file?
Please help in resolving this error.
Go to your pubspec.yaml file , and add the http dependency:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: any
Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'
And don't forget to run this command in your terminal :
flutter packages get
I had the same problem. You just have to add latest http dependencies in pubspec.yaml
Here is the full code,
dependencies:
flutter:
sdk: flutter
http: ^0.12.0+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
Don't forget to change verson no. of http
To check latest version of http click here
If you are running app directly from command line then you could also do:
with Flutter:
$ flutter packages get
with pub:
$ pub get
I've found that, when in VS Code, you might need to restart the editor to get it to see the new http module that 'pub get' pulled in. You can have your .dart code and pubspec.yaml exactly right but you still get the compiler/lint error.
You need to import like this:
import 'package:http/http.dart' as http;
add below to pubspec.ymel file
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0+1
use flutter pub to find the latest version
call
flutter packages get
1.Install http package
flutter pub add http
2.check pubspec.yaml file
dependencies:
http: ^0.13.4
3.Import in file
import 'package:http/http.dart';
Reference
just got to pubspec.yaml file and tweak some changes in file
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http:
under dependencies section just add http like in code description .
flutter will automatically resolve it and will add updated version of http .
You have to add the http dependency in the pubspec.yaml file as shown below:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0+2
Please take note of the indentation. After doing the above, run the below command in your terminal:
flutter packages get
As at the time of writing this, the latest http version is 0.12.0+2. You can learn more by visiting this link.
this worked for me:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: any
then:
flutter doctor -v
Finally:
flutter packages get
1. Add this to your package's pubspec.yaml file:
dependencies:
http: ^0.12.1
2. install it :
$ flutter pub get
3. Now in your Dart code, you can use:
import 'package:http/http.dart' as http;
Add below to pubspec.yaml file
dependencies:
http: ^0.12.0+1
Or Just add http
dependencies:
http:
flutter will automatically used latest version of http .
Then use pub get
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
http: ^0.12.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
try to update the sdk versions and then pub get or flutter pub get to get the packages get install
just add in pubspec.yaml
http: ^0.12.0+2
like as
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
http: ^0.12.0+2
and run in terminal
flutter pub get
finally add in class
import 'package:http/http.dart' as http;
When I got this issue, I just close the project from Android Studio (File -> Close Project). And then open it again.
That works for me.
Simply just Restart the project.
But Make sure to add the certain dependency to the pubspec.yaml file and do pub get.
-Just run this below command in your project directory to install http module
flutter pub add http
You first find 'dependencies:' in pubspec.yaml
then under 'dependencies:' type http: ^0.12.0+2 and then press ctrl + s to run get packages.
sample:
dependencies:
http: ^0.12.0+2
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
cupertino_icons: ^0.1.2
http: any
http:
have to be align with the other dependencies.
I had the same issue although I had the latest http package in Pubspec.yaml file. This error was still in there I did these 2 steps and error was resolved.
Remove import 'dart:_http'; if it is there
Add import 'dart:convert';
I just tried to get package from pubspec.yaml (with flutter packages get command) in my Flutter project but it raised this error :
Got socket error trying to find package android_alarm_manager: ^0.1.0"
I'm working on my company computer (Windows 7) that is behind proxy but I absolutely have no problem for other packages (ex. font_awesome_flutter: 6.0.0).
I tried with flutter beta version.
pubspec.yaml
name: background
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
font_awesome_flutter: 6.0.0
android_alarm_manager: ^0.1.0
isolate: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter
uses-material-design: true
remove the proxy you are using first then get the package again
I'm trying to add a reference to openid_client in my flutter app.
I add a dependency to openid_client: ^0.1.3 in my pubspec.yaml and save. This runs flutter packages get, which reports the following error:
Package unscripted has no versions that match >=0.6.2 <0.7.0 derived from:
- openid_client 0.1.0 depends on version >=0.6.2 <0.7.0
Indeed, the openid_client package does depend on unscripted version 0.6.2, but my flutter app cannot reference 0.6.2. It appears the highest version of unscripted my flutter app can reference is 0.3.4. Does anyone know what I'm doing wrong?
This is my pubspec.yaml as it currently stands:
name: flit
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
english_words: ^3.1.0
openid_client: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true