New to Flutter. I'm working on this app and on "flutter build ios --release" command is 407Mb on size, with apk instead i have 25Mb. I've tried downgrade flutter without results, still the same sizes even if my assets folder is just 8.6Mb. This is my yaml file:
name: ragogna
description: Nuova app per la comunita.
version: 1.0.0+1
environment:
sdk: '>=2.7.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
share: ^0.6.3+5
font_awesome_flutter: ^8.5.0
sliver_fill_remaining_box_adapter: ^0.1.1
url_launcher: ^5.4.1
provider: ^3.2.0
add_2_calendar: ^1.3.1
photo_view: ^0.9.2
cached_network_image: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
- assets/event_images/
- assets/locations/
- assets/itinerari/
fonts:
- family: Kievit
fonts:
- asset: fonts/Kievit-Book.ttf
- asset: fonts/Kievit-Medium.ttf
- family: Charter
fonts:
- asset: fonts/Charter.ttf
This is the error
description: A new Flutter project.
version: 0.9.91+50
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
SDK: flutter
cupertino_icons: ^0.1.2
audioplayers: ^0.11.0
agora_rtc_engine: ^0.9.4
cached_network_image: ^0.7.0
country_pickers: ^1.0.1
dio: ^2.0.22
flutter_launcher_icons: ^0.7.0
flutter_rating: ^0.0.2
fluttery: ^0.0.8
font_awesome_flutter: ^8.4.0
get_it: ^1.0.3
google_sign_in: ^4.0.1+3
image_picker: ^0.5.0+3
intl: ^0.15.7
intro_views_flutter: ^2.4.0
permission_handler: ^3.0.0
photo_view: ^0.2.1
razorpay_plugin: ^0.2.9
rxdart: ^0.21.0
shared_preferences: ^0.5.1+1
side_header_list_view: ^0.0.4
strings: ^0.1.0
url_launcher: ^5.0.2
path_provider: ^0.5.0+1
screen: ^0.0.5
flutter_typeahead: ^1.4.0
flutter_chips_input: ^1.2.0
intro_slider: ^1.2.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_icons:
android: "ic_launcher"
ios: true
image_path: "assets/images/ic_launcher.jpg"
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/
This is my pubspec.YAML file.
I have installed flutter and tried to run an existing flutter project on iPhone.
When I try running flutter, I get this error.
I tried searching for solutions but couldn't find one. Can anyone let me know what needs to be done?
I cannot find fluttery package in pub
Maybe is deleted. Check fluttery_dart2 as an alternative.
This is happening because flutter configured podfile that way. Default generated podfile by flutter won't allow ios build to download the nested dependencies.
To resolve you can alter podfile file by this and your issue would be resolved.
Search for this piece of code
target 'Runner' do
# Flutter Pod
And replace it with below
target 'Runner' do
use_frameworks!
# Flutter Pod
Update
Fluttery package is removed/temporary down due to flutter upgrade. So you should update your pubspec.yaml file with
fluttery_dart2: ^0.0.9
library to use the same functionality. Well this library will not be for long time once the original one will back.
Please read the note here
So I've tried generate classes DI classes for the inject.dart using flutter generate
It seems to generate classes under lib/* but not for test/*. It does not throw any error as such. Here are my relevant flutter classes.
pubspec.yaml
name: gc_client
description: A gc
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
json_annotation: ^2.0.0
rxdart: ^0.22.0
dio: ^2.1.3
inject:
path: ./inject.dart/package/inject
builders:
json_serializable: ^2.0.0
inject_generator:
path: ./inject.dart/package/inject_generator
dev_dependencies:
test: 1.6.1
flutter_test:
sdk: flutter
mockito: ^4.0.0
flutter:
uses-material-design: true
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/raleway_regular.ttf
- asset: assets/fonts/raleway_medium.ttf
weight: 700
assets:
- assets/
Component classes
Am I missing something? Let me know if you need more info. Thanks in advance.
The issue is with the build runner.
Here's a relevant fix for the same
https://github.com/flutter/flutter/issues/33266
Getting error in pubspec.yaml file with flutter_google_places: ^0.2.1 plugin like below:
How can i get rid of this type of issues in flutter.
Note: There is no indentation for the package
Error on line 18, column 3 of pubspec.yaml: A package may not list itself as a dependency.
flutter_google_places: ^0.2.1
^^^^^^^^^^^^^^^^^^^^^
pubspec.yaml file:
name: flutter_google_places
description: A new Flutter application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_google_places: ^0.2.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
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
You can't have a dependency that has the same name as your project
name: flutter_google_places
You need to change the name: ...
I had a problem quite similar... because I created the project named "Flutter_modular" and I tried to insert the "flutter_modular" in my pubspec.yaml.
dependencies:
flutter:
sdk: flutter
flutter_modular:
The project name can't be the same as the dependencies.
Project name and dependency title must be different.
name:
name: flutter_google_places
and
dependencies:
flutter:
sdk: flutter
flutter_google_places: ^0.2.1
Don't use project_name and dependency_name same String
Example :- pubspec.yaml file
name: sqflite //project_name
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
sqflite: ^1.3.1+1 //dependency_name
there must be a problem with your project name. Project name cannot be as same as a package name.
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';