Problem in importing some Flutter package - flutter

I can't import the firebase_auth package in Flutter. I did everything they said in the installation part (as shown below). Other packages are imported and working properly, but firebase_auth isn't.
name: flash_chat
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0<3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
animated_text_kit: ^2.2.0
firebase_core: ^0.5.0
firebase_auth_platform_interface: ^2.0.1
firebase_auth_web: ^0.3.0+1
firebase_core_platform_interface: ^2.0.0
cloud_firestore: ^0.14.0+2
firebase_analytics: ^6.0.0
firebase_messaging: ^7.0.0
firebase_auth: ^0.18.0+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
And I did the pub get. Can anybody help me?

These are a few suggested solutions:
Reload your IDE
Delete your pubspec.lock file and re run pub get.

Related

Flutter not able to build release version of application

flutter run works but flutter run --release or flutter run --release --profile returns the error below:
===== CRASH =====
si_signo=Segmentation fault: 11(11), si_code=1, si_addr=0x0
version=2.18.6 (stable) (Tue Dec 13 21:15:14 2022 +0000) on "macos_simarm64"
pid=14192, thread=-1, isolate_group=isolate(0x7f910c011200), isolate=(nil)(0x0)
isolate_instructions=0, vm_instructions=0
Stack dump aborted because InitialRegisterCheck failed.
Dart snapshot generator failed with exit code -6
Here's my pubspec.yaml dependencies:
version: 1.0.0+1
environment:
sdk: ">=2.15.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_native_splash: ^2.1.6
table_calendar: ^3.0.8
image_stack: ^2.1.1
intl: ^0.17.0
shimmer: ^2.0.0
flutter_riverpod: ^1.0.4
auto_route: ^5.0.4
google_fonts: ^3.0.1
pinput: ^2.2.9
mask_text_input_formatter: ^2.3.0
firebase_core: ^1.21.1
dio: ^4.0.6
dio_cache_interceptor: ^3.2.7
dio_cache_interceptor_hive_store: ^3.1.1
http: ^0.13.5
enum_to_string: ^2.0.1
mobile_scanner: ^2.1.0
firebase_auth: ^3.3.19
image_picker: ^0.8.5+3
image_cropper: ^3.0.1
firebase_storage: ^10.2.18
fluttertoast: ^8.0.9
firebase_messaging: ^13.0.1
hive: ^2.2.1
hive_flutter: ^1.1.0
flutter_hooks: ^0.18.5+1
hooks_riverpod: ^1.0.4
local_auth: ^2.1.0
lottie: ^2.1.0
flutter_local_notifications: ^9.7.0
device_info_plus: ^4.0.1
timeago: ^3.2.2
url_launcher: ^6.1.5
focused_menu: ^1.0.5
rxdart: ^0.27.7
rate_my_app: ^1.1.3
infinite_scroll_pagination: ^3.2.0
flutter_offline: ^2.1.0
webview_flutter: ^4.0.1
shared_preferences: ^2.0.15
web_socket_channel: ^2.2.0
fl_chart: ^0.55.2
dev_dependencies:
#flutter_gen_runner:
auto_route_generator: ^5.0.2
firebase_core_platform_interface: ^4.5.1
build_runner: any
flutter_lints: ^2.0.1
flutter_launcher_icons: ^0.11.0
flutter_test:
sdk: flutter
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icons/b2b_logo.png"
flutter:
uses-material-design: true
generate: true
assets:
- assets/images/
- assets/
- assets/animations/
- assets/icons/
fonts:
- family: SnagIcons
fonts:
- asset: assets/fonts/SnagIcons.ttf</summary>
The application from 2 months ago was building successfully but as of last week, I have been getting this issue and reverting the changes i still get the same issue.
Try to switch to flutter dev channel and back to flutter stable.
Do a flutter clean and flutter pub get and try it again.
This occours because of the some updates in the packages
Try entering the below code in the vs code terminal:
flutter clean
flutter pub get
Your flutter code will work like a charm!
Edit:
There are github issues which address this,see if any works for you
https://github.com/flutter/flutter/issues/43707
https://github.com/flutter/flutter/issues/109818
https://github.com/flutter/flutter/issues/43597
So, after raising the issue on the flutter channel, the problem was caused by returning a late variable from a future method so there was a fix in the release of flutter 3.7 which will remedy this problem
You can view the issue here on GitHub

So, because postureapp depends on both audioplayers ^0.17.0 and flutter_driver any from sdk, version solving failed

After a long time, I am trying to run my flutter project that used to run successfully. After doing flutter upgrade, I get the following dependency error. I have tried multiple possible fixes from similar issues I have found, but I still get similar errors. Any help is much appreciated.
Because audioplayers >=0.16.2 <0.18.0 depends on uuid ^2.2.2 and no versions of uuid match >2.2.2 <3.0.0, audioplayers >=0.16.2 <0.18.0 requires uuid 2.2.2.
And because uuid 2.2.2 depends on crypto ^2.0.0 and every version of flutter_driver from sdk depends on crypto 3.0.1, audioplayers >=0.16.2 <0.18.0 is incompatible with flutter_driver from sdk.
So, because postureapp depends on both audioplayers ^0.17.0 and flutter_driver any from sdk, version solving failed.
pub get failed (1; So, because postureapp depends on both audioplayers ^0.17.0 and flutter_driver any from sdk, version solving failed.)
exit code 1
my pubspec.yaml file:
environment:
sdk: ">=2.2.0 <3.0.0" # ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
image_picker: ^0.6.5
firebase_core: ^1.0.0 #^0.7.0
firebase_ml_vision: ^0.10.0 #^0.9.3+8
camera: ^0.8.0 #^0.5.6+1
smooth_page_indicator: ^0.1.5
simple_animations: ^2.1.1
flutter_statusbarcolor: ^0.2.3
gradient_widgets: ^0.5.1
time: "^1.3.0"
audioplayers: ^0.17.0 #^0.15.1
path_provider: ^1.6.0 #^1.5.1
wakelock: ^0.1.4+1
poller: ^1.1.3
permission_handler: ^6.1.0
mutex: ^1.1.0
dependency_overrides:
path_provider: ^2.0.0
dev_dependencies:
pedantic: ^1.8.0
e2e: ^0.2.1
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test: any
path: ^1.6.2
flutter_launcher_icons: ^0.8.1
flutter_launcher_name: ^0.0.1
# path_provider: ^0.5.0+1
flutter_icons:
image_path: "assets/images/logo.png"
android: true
ios: true
flutter_launcher_name:
name: "MyApp"
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/sounds/
Removing the version number of audioplayer, and some other libraries fixed the issue.

how can I increase my flutter web performance and how can i remove leggence in my flutter web?

I build web application in flutter but the performance of my web application is too bad its not smooth its too much leggy what can I do to solve this problem?
give me suggestions
i also try many solutions but these are not working for my flutter web i also make release of my web that's also leggy like my deub mode.
my pub yaml file
name: doctor appointment
description: Oriel Research Therapeutics online services.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# firebase_core: "^0.7.0"
firebase_core: ^1.0.1
# firebase_auth: "^0.20.0+1"
firebase_auth: ^1.0.1
# flutter_signin_button: ^1.1.0
shared_preferences: ^2.0.5
cloud_firestore: ^1.0.4
firebase_storage: ^8.0.6
# The following adds the Cupertino Icons font to your application.
# Use with the Cupertino Icons class for iOS style icons.
cupertino_icons: ^1.0.1
flutter_custom_clippers: ^1.1.2
responsive_builder: ^0.1.2
# velocity_x: ^1.0.1
velocity_x: ^2.6.0
url_launcher: ^6.0.2
provider: ^4.3.2
footer: ^0.0.3
# youtube_player_iframe: ^1.2.0+2
carousel_slider: ^3.0.0
youtube_plyr_iframe: ^2.0.0
get: ^3.25.4
package_info: ^0.4.3+4
modal_progress_hud: ^0.1.3
equatable: ^2.0.0
file_picker: 3.0.0
dio: ^4.0.0
webview_flutter: ^1.0.0
# js: ^0.6.2
page_transition: "^1.1.7+6"
http:
flutter_credit_card: ^2.0.0
font_awesome_flutter: ^9.0.0
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/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/logos/
- assets/services/
- assets/team/
- assets/images/
Try the below Links. Helped me solve some performance issues by getting rid of page transitions.
https://medium.com/flutter/optimizing-performance-in-flutter-web-apps-with-tree-shaking-and-deferred-loading-535fbe3cd674
https://medium.com/flutter/improving-perceived-performance-with-image-placeholders-precaching-and-disabled-navigation-6b3601087a2b

How to get the matching version of shared preferences, upgradder and other packages?

I have a problem on matters upgrader, it's seems i can't build my apps when it come to difference version off package
here is the problem
Running "flutter pub get" in Mobile7Merge...
Because requests 3.3.0 depends on shared_preferences ^0.5.2 and no versions of requests match >3.3.0 <4.0.0, requests ^3.3.0 requires shared_preferences ^0.5.2.
So, because mobile7 depends on both requests ^3.3.0 and shared_preferences ^2.0.3, version solving failed.
pub get failed (1; So, because mobile7 depends on both requests ^3.3.0 and shared_preferences ^2.0.3, version solving failed.)
here is my pubspec.yaml
name: mobile7
description: Mobile 7
version: 1.0.0+1
environment:
sdk: ">=2.5.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.1
lazy_load_scrollview: ^1.1.0
flutter_appauth: ^0.9.1
flutter_secure_storage: ^3.3.3
fl_chart: ^0.10.1
flutter_datetime_picker: ^1.3.8
intl: ^0.16.1
google_nav_bar: ^2.2.0
line_icons: ^0.2.0
google_fonts: ^1.1.0
equatable: ^1.2.5
bloc: ^6.0.3
flutter_bloc: ^6.0.5
rxdart: ^0.23.1
expandable: ^4.1.4
jiffy: ^3.0.1
requests: ^3.3.0
flutter_html: ^1.0.0
webview_flutter: any
flutter_downloader: ^1.4.4
path_provider: ^1.6.24
permission_handler: ^5.0.1
fluttertoast: ^7.1.1
# flutter_cached_pdfview: ^0.3.0
# flutter_pdfview: ^1.0.0+10
upgrader: ^3.0.0
dio: any
advance_pdf_viewer: ^1.2.0
pinch_zoom: ^0.0.4
dart_date: ^1.0.7
flutter_inappwebview: ^4.0.0+4
shared_preferences: ^2.0.3
# shared_preferences: ^0.5.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
I thought to have two package at the same time, that is 2.0.3 and 0.5.2 but either any of them have solve my problem, i tried to search if i can use two package with the same name but mainly, thos shared_preference are inside request package and upgrader package, i tried to include there on my own
How can i solve this??
Managing dependencies can be a pain some times but I have found this commands can be useful:
flutter pub outdated https://dart.dev/tools/pub/cmd/pub-outdated
flutter pub upgrade --major-versions https://dart.dev/tools/pub/cmd/pub-upgrade#--major-versions

Flutter Invalid plugin specification path_provider_windows

when I try to add libraries in which cache images from server like :
cached_network_image
flutter_advanced_networkimage
the lib download to lib folder but project can't be build and show error:
Invalid plugin specification path_provider_windows.
Invalid "windows" plugin specification.
here is my pubspec.yaml
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
get_it: ^2.0.1
flutter_bloc: ^4.0.0
equatable: ^0.4.0
dartz: ^0.8.6
data_connection_checker: ^0.3.4
dio: ^3.0.10
shared_preferences: ^0.5.3+4
image_picker: ^0.6.7
#flutter_advanced_networkimage: ^0.7.0
#cached_network_image: ^2.3.2+1
google_maps_flutter: ^0.5.28+1
permission_handler: ^5.0.0+hotfix.8
url_launcher: ^5.4.10
mailto: ^0.2.0+1
shamsi_date: ^0.9.0
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
firebase_messaging: ^6.0.16
firebase_crashlytics: ^0.1.3+3
dev_dependencies:
flutter_test:
sdk: flutter
gen_lang: 0.1.3
mockito: ^4.1.0
flutter_launcher_icons: "^0.7.3"
This isn't technically me answering the question however the dev team have picked up on this issue and they are in the process of fixing it
Here is the github link to their fix: https://github.com/flutter/flutter/issues/66158
EDIT:
According to the issue logged on Github a fix would be to pub upgrade which would theoretically upgrade you to the latest working version of path_provider, not sure if this works though I have yet to try it myself