Automatically associate Flutter SDK with project in WebStorm - webstorm

Is there a way to configure WebStorm to automatically associate the Flutter SDK path with an imported project?
I've found out that if I clone a project from GitHub and open it in WebStorm, it doesn't associate with the SDK, rather it says "No Flutter SDK configure". To resolve this, I will have to go to File > Settings > Languages & Frameworks > Flutter to manually specify the path to the SDK for the current project. However, this is not the case with a project started from scratch where Flutter is chosen from the beginning.
Flutter doctor seems to indicate I've installed the SDK. It is not a particularly big problem but it just adds an extra step that is annoying.
[✓] Flutter (on Linux, channel master)
• Flutter at /home/driftavalii/workspace/flutter
• Framework revision c5cf8e0190 (4 days ago), 2017-05-13 11:11:58 -0700
• Engine revision f1bfdddfc8
• Tools Dart version 1.23.0-dev.11.11
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /home/driftavalii/Android/Sdk
• Platform android-25, build-tools 25.0.3
• ANDROID_HOME = /home/driftavalii/Android/Sdk
• Java binary at: /usr/local/android-studio/jre/bin/java
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Android Studio (version 2.3)
• Android Studio at /usr/local/android-studio
• Gradle version 3.2
• Java version: OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] IntelliJ IDEA Community Edition (version 2017.1)
• Dart plugin version 171.4424
• Flutter plugin version 13.0
[✓] WebStorm (version 2017.1)
• Flutter plugin version 13.1
[✓] Connected devices
• None

This is likely a bug with our WebStorm support in the flutter plugin. Can you file an issue at https://github.com/flutter/flutter-intellij/issues? Thanks!

Related

'Execution failed for task ':amplify_core:compileDebugKotlin' ' error message in Flutter

My Windows updated and my app wouldn't run because I had to update a few things and managed to sort the issues that arose out. My app stopped compiling again and turns out I had to redownload flutter and it started compiling again. And now it's back to not compiling, this error, however, has become difficult for me to solve.
This is the error I get when I try to compile my app.
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core-0.2.10\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (26, 1): Class 'AtomicResult' is not abstract and does not implement abstract member public abstract fun error(p0: String, p1: String?, p2: Any?): Unit defined in io.flutter.plugin.common.MethodChannel.Result
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core-0.2.10\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (54, 5): 'error' overrides nothing
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core-0.2.10\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (66, 26): Type mismatch: inferred type is String? but String was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':amplify_core:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Exception: Gradle task assembleDebug failed with exit code 1
I tried migrating code to AndroidX, upgrading flutter, flutter channel is stable. I need help.
Below is the result of flutter doctor.
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1889])
• Flutter version 3.0.5 at C:\source\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.3.32804.467
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] Connected device (4 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1889]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.81
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.54
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
C:\Users>flutter channel
Flutter channels:
master
beta
* stable
In your project folder, look for the build.gradle file at the root of your Android directory and upgrade to the latest version of Kotlin. For the moment the version is at 1.7.10, so go to the Kotlin website and check the last version released. In the file it will look like this:
ext.kotlin_version = '1.7.10

TDD in Flutter/Dart. How to reduce start up time

I try to do Test-Driven Development (TDD) in Dart for the business logic of apps with Flutter. The startup time for running the test feels a little bit slow for fast TDD cycles. It is around 4-5 seconds on my machine.
I am using the package:test/test.dart, so there is no need to deploy the app onto the device and the tests can run locally on the Dart VM. The tests themselves run fast.
While developing Android native apps with Java's JUnit and the local Java VM the startup time was much faster < 1sec.
Is there a way to get the start-up time for unit testing in Dart that fast too? (Without buying a much faster physical machine).
Edit:
My Dart versions:
Flutter doctor -v: 2.0.0-dev.54.0.flutter-46ab040e58
The Dart Plugin uses:
2.0.0-edge.c080951d45e79cd25df98036c4be835b284a269c and is in my flutter installation: C:\flutter\bin\cache\dart-sdk
The Dart tests are inside a Flutter project. I start the Dart tests in Android Studio via right-clicking a file with a test or just use the ">" run test buttons in the IDE. Android Studio then generates a run config, so I can start it with keyboard shortcuts fast.
I've tried running a sample test (using the Flutter demo app) recently, running flutter test through the terminal initializes the test in an instant.
However, I got similar startup time (around 4 seconds) when the tests were run through the UI.
I tried digging into the settings and there doesn't seem to be any config that we can modify to make the tests initialize faster compared to what we have at present.
Here's my flutter doctor for reference.
[✓] Flutter (Channel master, 1.26.0-2.0.pre.281, on macOS 11.1 20C69 darwin-x64)
• Flutter version 1.26.0-2.0.pre.281
• Framework revision 4d5db88998 (2 weeks ago), 2021-01-11 10:29:26 -0800
• Engine revision d5cacaa3a6
• Dart version 2.12.0 (build 2.12.0-211.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Platform android-30, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0.1, Build version 12A7300
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.18.1
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.96
• No issues found!
This method works perfectly for me:
1. flutter run --profile --cache-sksl
2. Press M at the command line of flutter run to write the captured SkSL shaders into a file named something like flutter_01.sksl.json.
3. Build the app with SkSL warm-up using the following, as appropriate:
Android:
flutter build apk --bundle-sksl-path flutter_01.sksl.json
or
flutter build appbundle --bundle-sksl-path flutter_01.sksl.json
iOS:
flutter build ios --bundle-sksl-path flutter_01.sksl.json
For more information, visit: https://flutter.dev/docs/perf/rendering/shader

Unable to run Dart2 w/ Angular for web along side Flutter for mobile project - plan to share code

I have made good progress with Flutter on mobile apps. Currently using:
[✓] Flutter (Channel master, v0.3.1-pre.13, on Mac OS X 10.13.4 17E199, locale en-US)
• Flutter version 0.3.1-pre.13 at /Users/golftocs/PhpstormProjects/flutter
• Framework revision 85be28d36b (32 hours ago), 2018-04-16 14:02:07 -0700
• Engine revision 76cb311d9c
• Dart version 2.0.0-dev.47.0.flutter-f76dad0adc
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.1)
• Android SDK at /Users/golftocs/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.1
• ANDROID_HOME = /Users/golftocs/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 23.1.2
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[!] Connected devices
! No devices available
Now I want to begin a project that uses this Flutter set-up for mobile and share code with a Dart2/Angular web app. I am unable to get a web app working successfully. I've cloned https://github.com/angular-examples/toh-5 and based on running 'pub get' this is returned:
Overriding the upper bound Dart SDK constraint to <=2.0.0-
edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0 for the following packages:
archive, args, barback, bazel_worker, boolean_selector, build_barback,
build_config, build_modules, charcode, cli_util, code_transformers,
convert, crypto, csslib, dart_style, fixnum, front_end, glob, graphs,
html, http, http_multi_server, http_parser, intl, io, isolate, js,
json_annotation, kernel, logging, matcher, meta, multi_server_socket,
node_preamble, package_config, package_resolver, path, plugin, pool,
protobuf, pub_semver, quiver, quiver_hashcode, shelf,
shelf_packages_handler, shelf_static, shelf_web_socket,
source_map_stack_trace, source_maps, source_span, stack_trace,
stream_channel, string_scanner, term_glyph, test, tuple, typed_data, yaml
Then, when I run 'pub run build_runner serve' from my terminal I get:
[INFO] Generating build script completed, took 446ms
[INFO] Setting up file watchers completed, took 25ms
[INFO] Waiting for all file watchers to be ready completed, took 199ms
[INFO] Building new asset graph completed, took 921ms
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms
[SEVERE] build_web_compilers|ddc on package:angular_router/src/url.module:
ProcessException: No such file or directory
Command: /Users/golftocs/PhpstormProjects/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read angular_router|lib/src/url.ddc.js, check your console or the `.dart_tool/build/generated/angular_router/lib/src/url.ddc.js.errors` log file.
[SEVERE] build_web_compilers|ddc on package:angular_router/src/location/platform_location.module:
ProcessException: No such file or directory
Command: /Users/golftocs/PhpstormProjects/flutter/bin/cache/dart-sdk/bin/dartdevc --persistent_worker
[WARNING] build_web_compilers|entrypoint on web/main.dart:
Unable to read angular_router|lib/src/location/platform_location.ddc.js, check your console or the `.dart_tool/build/generated/angular_router/lib/src/location/platform_location.ddc.js.errors` log file.
...
Additionally, I am using WebStorm, actually PHPStorm, and the Pub actions links to 'Get Dependencies, Upgrade...' do not work. I can only execute from terminal.
My desire is to get to:
1) share code between mobile & web similar to https://github.com/apptreesoftware/letsvote/blob/master/README.md
2) run latest Dart2 with Angular5.0.0-alpha and current Flutter master channel
3) WebStorm IDE work seamlessly with either from a combined project
Thanks.
shared_code
|- flutter_project
|- angular_project
where both flutter_project and angular_project have shared-code as a dependency in pubspec.yaml
dependencies:
shared_code:
path: ../shared_code
assuming a directory structure like
my_project/shared_code
my_project/flutter_project
my_project/angular_project
The code in shared_code must not depend in any way on dart:io or flutter:ui otherwise it won't work with either flutter_project or angular_project
If you want to open all 3 at the same time in IntelliJ in the same window, adding them all as module to a single project worked for me.
When I work on the Angular project I need to switch the Dart SDK in the Dart plugin to the Dart SDK, when I work on the Flutter project to the Flutter Dart SDK, otherwise running the app and tests doesn't work.
You can also open each project in its own IntelliJ window which keeps the setting for each window individually and doesn't need to switch depending on what code you're currently working.

visual studio 2017 .NET SDK does not support targeting .NET Core 2.0

I am breaking my head over this for a while now:
I have tried installing both professional and community version of visual studio 2017 v 15.5.2
and installed .net core Runtime 2.0.3 and .net core SDK 2.1.2.
When I open a new web application I get an error saying
"the sdk 'microsoft.net.sdk.web' specified could not be found"
When I try to build an existing project I get an error
"the current .NET SDK does not support targeting .NET Core 2.0. Either
target .NET Core 1.1 or lower, or use a version of the .NET SDK that
supports .NET Core 2.0."
I don't see ".net core 2.0" in my target framework
I don't have global.json file in my computer
When I try dotnet --info, I get this
.NET Command Line Tools (2.1.2)
Product Information:
Version: 2.1.2
Commit SHA-1 hash: 5695315371
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
Some one please help
Fixed it by adding a MSBuildSdksPath userVariable.
Add an Enviroment variable named MSBuildSdksPath.
It's value should point to a Dotnet SDK folder. Eg:
C:\Program Files\dotnet\sdk\2.2.102\Sdks

Crosswalk Cordova does not build with Android 4.0.3

I need to target older device with a cordova application and hope that https://crosswalk-project.org/ will help to solve compatibility issue with older webviews
I followed the instructions in https://crosswalk-project.org/#documentation/cordova/migrate_an_application/migrate-using-adt
xwalk_core_library and Cordova does not build for Android 4.0.3 (API 15)
I tried
crosswalk-cordova-5.34.104.4-x86
crosswalk-cordova-6.35.131.7-x86
crosswalk-cordova-7.35.144.0-x86
none of them are working,
It does build fine with Android 4.4.2 (API 19)
I saw Crosswalk Cordova does not build question and answer but answer solve latest android version and not for Android 4.0.3
Crosswalk no longer supports Android 4.0.3.
(Despite online documentation,) when you install the plugin (in cordova) you will be advised ICS no longer supported - earliest Android supported is 4.1 (Jellybean) at the time of this post.
Crosswalk Apps supports Android 4.0 and the above. Crosswalk Cordova App built by higher Android SDK should just work on Android 4.0.3 as well, The App itself doesn't have to be built by Android 4.0.3.
if you have future questions, you are welcome to visit the follow link for more timely feedback..
https://crosswalk-project.org/#documentation/community