Pub can't retrieve any Dart packages - dart

No matter which dart package I am trying to fetch, pub fails retrieving it.
When in my project root folder, I run:
flutter packages get
I consistently get:
Got socket error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
Here is the output from flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (on Mac OS X 10.13.3 17D47, locale en-US, channel beta)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.5)
[!] VS Code (version 1.21.1)
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
and the pubspec is what comes with IntelliJ Flutter's wizard:
name: my_friendchat
description: A new Flutter project.
dependencies:
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.1"
Any idea how to fix pub?

So... restarting my laptop just fixed it. 😕

Related

Jenkins unable to find pod for flutter build

I am trying to setup CI/CD for flutter using jenkins, i am successful in building the android part but jenkins is unable to locate pod when building iOS.
when i execute flutter doctor, it returns cocoapods not installed.
Jenkins Output:
+ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.4 21F79 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 13.4)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
[Pipeline] sh
+ pod install
/Users/mobilesotf/.jenkins/workspace/TPL Surveyor app#tmp/durable-f6e4ebbb/script.sh: line 1: pod: command not found

Login Error: There is an error in logging you into this application. Please try again later Flutter iOS

I am working on facebook authentication for a flutter project. App works out of the box on Android but on iOS, throws following error in safari.
Translation in english is: Login Error: There is an error in logging you into this application. Please try again later.
There are many similar issues but all are on Android, not on iOS.
Following is flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-PK)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more
details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.0)
[✓] Connected device (2 available)
I am using flutter_facebook_auth: ^3.5.7. A reminder, facebook login is working fine on Android, issue is on iOS only.
Thanks

iOS app icon not showing up using flutter

I have tried so many ways and fixes but my app icon still not showing up. I'm using flutter and I used the flutter_launcher_icons package but still no use.
Here's my pubspec.yaml dev_depend:
dev_dependencies:
flutter_launcher_icons: "^0.7.3"
flutter_test:
sdk: flutter
and here the config:
flutter_icons:
android: "launcher_icon"
ios: "AppIcon"
image_path_ios: "assets/icon/icon.png"
image_path: "assets/icon/icon.png"
and here's my AppIcon file
This is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-1.0.pre.118, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[!] IntelliJ IDEA Community Edition (version 2018.2.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
This is my Asset Catalog App Icon looks like:
Thanks to #SamiHaddad, I missed setting the AppIcon to Asset Catalog App Icon Set Name in the general section of the Runner file in Xcode. This fixed my issue.
It is worked for me in iOS through manual changes when dependency not worked:-
I have generated app icon which required in manual icon changes through site
(appicon.co)
There I got zip file of Image in which I found a folder Assets.xcassets
after extracting the zip file
I found Appicon.appiconset inside the folder Assets.xcassets
I replaced that Appicon.appiconset folder to
iOS/runner/Assets.xcassets/Appicon.appiconset folder
Flutter pub get
Flutter Run

Flutter: iOS build fails

I have an issue with Flutter. I can't run my app on an iOS simulator. I've tried to create a new certificate under the Mac keychain and that didn't help me much. Does anyone know how I can fix this problem?
(base) seroaslan#Seros-MBP Desktop % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale da-DK)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.5)
[!] IntelliJ IDEA Ultimate Edition (version 2020.1.1)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.44.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
(base) seroaslan#Seros-MBP tutorial % flutter run
Launching lib/main.dart on iPhone 8 in debug mode...
Running Xcode build...
├─Assembling Flutter resources... 2,8s
└─Compiling, linking and signing... 3,0s
Xcode build done. 9,2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/seroaslan/Desktop/tutorial/build/ios/Debug-iphonesimulator/Runner.app: resource fork, Finder
information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 8.
The answer is in your flutter doctor:
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
You will need to fix these issues by setting it all up again as shown here: https://flutter.io/setup-macos/

Flutter stuck on Building Dart code after doing flutter build ios

I'm trying to build an archive by doing flutter build ios but I encounter a problem on Starting Xcode build
$ flutter build ios
Building com.example.example for the device (ios-release)...
Automatically signing iOS for device deployment using specified
development team in Xcode project: XXXXXX
Running pod install...
Starting Xcode build...
├─Building Dart code...
I already build an archive one (last week) and it was working. Maybe this is due to flutter upgrade ?
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14.1 18B75, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK
28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] VS Code (version 1.29.1)
That's an issue that was fixed very recently and the fix should already be available in the master channel.
flutter channel master
flutter doctor
You can also try dev channel, but I'm not sure if it landed there already.
The fix will of course be included in the next beta channel, but a beta release just came out last week, so it will probably take a while to the next.
See also https://github.com/flutter/flutter/issues/24139

Resources