Flutter iOS build takes forever (with firebase dependencies) - flutter

I'm making a small app using firebase/firestore to learn, and since adding the firebase components, build times have been insanely long for the iOS version of the App.
I've seen a few post mentionning that but I couldn't find definitive answers.
Any idea how to fix this? A clean build takes 10+ min, it's unusable.
Thanks in advance !
My pubspec.yaml's dependencies:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_core: ^2.4.1
firebase_auth: ^4.2.5
cloud_firestore: ^4.3.1
get_it: ^7.2.0
firebase_storage: ^11.0.10
path_provider: ^2.0.12
open_filex: ^4.3.2
Flutter doctor output:
[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6 21G115 darwin-x64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[!] Android Studio (version 2022.1)
✗ Unable to find bundled Java version.
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Community Edition (version 2022.3.1)
[✓] VS Code (version 1.74.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Use pre-built Firebase SDKs: Firebase provides pre-built SDKs for iOS that you can use in your Flutter project. This can help reduce build times as you won't have to build the Firebase SDKs yourself. You can find more information on how to use pre-built Firebase SDKs in the official documentation.
For example, you can check this repo for Firestore pre-built sdk
https://github.com/invertase/firestore-ios-sdk-frameworks

Related

Flutter launcher icons fails because --sound-null-safety missing

I am trying to create icons for my app using flutter_launcher_icons, with options defined in pubspec.yaml. When I run flutter pub run flutter_launcher_icons:main, I get the following error:
Unable to spawn isolate: error: Library 'file:///Users/cameron/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.0/bin/main.dart' was compiled with sound null safety (in strong mode) and it requires --sound-null-safety option at runtime
pub finished with exit code 1
Even if I pass in --sound-null-safety, the error persists (I also tried '--no-sound-null-safety' which also did nothing).
To check it wasn't a configuration error, I ran flutter create <name>, added flutter_launcher_icons: to dev dependencies (and flutter pub get), ran the same command and got the same error.
I am on Flutter 2.2, and I depend on integration_test, so I can't downgrade to a pre-null-safety version of flutter_launcher_icons, because those versions have transitive dependencies that conflict with integration_test from sdk.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.4)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!

cloud Firestore connect my flutter windows app

I already build a flutter android app, and it works with the Cloud_FireStore database. Now I want a connect my Cloud_FireStore database to my flutter Windows app, but I can't find any resources for Cloud_FireStore plugging for flutter Windows or how to connect Cloud_FireStore to Windows app.
my flutter doctor,
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.19.0-2.0.pre.131, on Microsoft Windows [Version 10.0.18363.836], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.6.0)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.45.1)
[√] Connected device (4 available)
I use Flutter Master channel mode to build Windows apps and no errors.
pubspec.yaml
dependencies:
cloud_firestore:
firebase_core:
these dependencies use to connect my Cloud_FireStore but it does not work with windows app.
Please help me!, Thank you.
Unfortunately as of today, the packages for Firebase only support MacOS, not Windows.
Source
Did you try firedart - https://pub.dev/packages/firedart? It supports Windows and the documentation says it all.
In pubspec.yaml file add-
dependencies:
firedart: ^0.9.0+1
Then in main.dart -
import 'package:firedart/firedart.dart';
...
void main() {
const projectId = 'c**d-p**s-3**7';
Firestore.initialize(projectId);
...
}
How to get your projectId-
Go to your cloud firestore project from https://console.firebase.google.com and look for
your project -> project settings -> general -> Project ID
This will connect your Flutter Windows desktop application with cloud firestore database.

flutter on mac desktop "No devices detected"

I have run:
export ENABLE_FLUTTER_DESKTOP=true
flutter channel master
flutter upgrade
Then on flutter doctor i get no devices available:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.10.15-pre.357, on Mac OS X 10.14.6 18G103, locale en-IL)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2019.1.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Community Edition (version 2019.1.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.39.2)
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
Did I miss anything? (I'm looking to develop a desktop app so not android emulator / ios emulator)
Whatever instructions you are following are out of date; ENABLE_FLUTTER_DESKTOP hasn't been the supported or documented way to enable experimental desktop support for several months (and the legacy code for it was recently removed). You need to enable it with flutter config as documented in the official instructions
Just Enable flutter desktop
flutter config --enable-macos-desktop

why java: package io.flutter.plugins.googlesignin does not exist?

When doing a build project in Intellij I get an error in GeneratedPluginRegistrant, cannot resolve GoogleSignInPlugin.
I followed directions at https://pub.dartlang.org/packages/google_sign_in#-installing-tab-
My pubspec.yaml: (I tried with and without ^).
dependencies: google_sign_in: "^3.0.5" flutter:
sdk: flutter
flutter doctor
Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.6 17G65, locale
en-US) [✓] Android toolchain - develop for Android devices (Android
SDK 28.0.2) [✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.1) [✓] IntelliJ IDEA Ultimate Edition
(version 2018.2.2)
It looks like we can ignore the build errors. Something I don't like, but everything works ok. Even building the apk on the command-line with 'flutter build apk'. https://flutter.io/android-release/
Dart isn't built like Android, so no need to build project when developing. However, the "cannot find plugin" error is a Java classpath error, just need to add to the classpath.
IntelliJ folks could probably do it for us.

Flutter After Upgrade can't run application version solving failed

Nope. This answer doesn't work this time for me.
My flutter doctor -v
[✓] Flutter (Channel master, v0.5.9-pre.68, on Linux, locale en_US.UTF-8)
• Flutter version 0.5.9-pre.68 at /home/khophi/.flutterSetup
• Framework revision 5cd97f0004 (2 hours ago), 2018-08-16 14:10:22 -0700
• Engine revision 4ee648914f
• Dart version 2.1.0-dev.0.0.flutter-be6309690f
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/khophi/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /home/khophi/Android/sdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
• All Android licenses accepted.
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] VS Code (version 1.26.0)
• VS Code at /usr/share/code
• Flutter extension version 2.17.1
[✓] Connected devices (1 available)
• klte • 956e8b90 • android-arm • Android 8.1.0 (API 27)
! Doctor found issues in 1 category.
When I run flutter run, I get:
Running "flutter packages get" in townsquare...
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because flutter_circular_chart 0.0.3 requires SDK version >=1.19.0 <2.0.0 and no versions of flutter_circular_chart match >0.0.3 <0.1.0, flutter_circular_chart ^0.0.3 is forbidden.
So, because mobile depends on flutter_circular_chart ^0.0.3, version solving failed.
pub get failed (1)
This is my pubspec.yaml
name: mobile
description: A new Flutter project.
version: 1.0.0+1
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
carousel: ^0.0.1
http: "^0.11.3+16"
validate: "^1.6.0"
url_launcher: "^3.0.2"
shared_preferences: "^0.4.2"
font_awesome_flutter: "^7.0.0"
flutter_circular_chart: "^0.0.3"
flutter_local_notifications: ^0.3.6
dev_dependencies:
flutter_test:
sdk: flutter
assets:
- images/flutter.jpg
- images/logo.png
- images/bg_viewer.jpg
With the above, please enlighten me, what's wrong?
That's is because you are using : Dart version 2.1.0-dev.0.0.flutter-be6309690f and the plugin named flutter_circular_chart has a constraint
https://github.com/xqwzts/flutter_circular_chart/blob/master/pubspec.yaml
environment:
sdk: '>=1.19.0 <2.0.0'
You can fork the project and update the sdk constraint and ref to your repository:
Like this:
flutter_circular_chart:
git: https://github.com/your_repo/flutter_circular_chart.git
Note
Also would be fine if you open an issue in their repo to notify the devs about the issue that you have.
Use devendency_override with same version witch need for same for other dependency.
Like google_maps_flutter: ^0.5.28+1 needs intl to be 0.16.0
then craete dependency_overrides:
intl: ^0.16.0
below of dev_dependencies:
flutter_test:
sdk: flutter
run project until it not run on device.
Enjoy. Thanks..