-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Flutter SDK is not available. #19049
Comments
In a Flutter project you need flutter packages pub run build_runner build lib |
Thank you! This, and adding "build_runner: any" to the dependencies made the program run. Strangely, however, it did not create the file "main.reflectable.dart" which I expected. Did I miss something here? |
It's better to add it to |
Thanks for your comment. I did as you said. Additionally, I had found somewhere else that one shouldn't use lib as the entry point, so I moved main.dart to a parallel directory entry_point and ran "flutter packages pub run build_runner build entry_point". It didn't complain, but resulted in "Succeeded ... with 0 outputs". Deleting the .dart_tool/ directory didn't help. I'll put the question on StackOverflow as you suggested. |
Where did you read that about the entry_point? |
See also google/reflectable.dart#117 |
I read about the entry points in another issue, but unfortunately do not seem to find it again. Anyway, it said that lib is only for libraries, and one should use another directory as entry point (the reflectable tutorial uses "web", by the way). I'll put a link to the SO question, once it's published. |
Command line apps use |
Thanks for the explanation. Meanwhile I got the SO question published: https://stackoverflow.com/questions/51169706/flutter-reflection-with-reflectable-working-example-needed |
Doing the things that you describe, @CryptUser, I do get the following:
Not sure where our experiments diverge, but it "should work" as far as I can see... ;-) |
@eernstg could you make the example project available on GitHub somewhere? |
Sure. I'd expect |
Thanks for the example project, this works for me as well :-) |
Thank you! I've fixed it up a bit more such that it actually uses Flutter, and a |
No, it's always like that. ;) |
Trying a bit further, I realised, that when moving main.dart to the test folder, and running |
@CryptUser, I have considered this behavior to be a built-in property of the build package, in the sense that it does not handle code generation for libraries under However, you mentioned the following here and here:
I had the same experience, I can't find it today. I've asked the main creator of the build package about this issue, will return later when I know more. |
I should say that I also tested to move main.dart to other directories (entry_point, other) and performed the respective |
I gues |
I didn't use build.yaml at all, since the tutorial at https://github.com/dart-lang/reflectable does not mention it's use. I'll try if I get it working with this file. |
Right, I discovered that as well. I'll add something about that, but it's all 'package build' related so you should be able to learn whatever there is to learn about build.yaml over there. |
That's exactly what I've asked about when I got in touch with the main creator of the build package (@jakemac53), but that clause came from him, so I assumed that it was needed. |
Adding the build.yaml from https://github.com/eernstg/reflectable-flutter to my project, the file main.reflectable.dart is still not created, when I use folders "other" or "entry_point" (for both the build.yaml and the flutter command, of course). Probably it's better to start from the working repo, and see what it takes to break it ;-) |
Would be great, and do tell us about it! |
Shouldn't the following work?
Again, I get 0 output when doing this. |
Maybe it's because you're not specifying what to build: |
I tried |
Trying it now. Also, we have this sentence here:
which seems to confirm that 'generate_for' is about filtering something which has already been selected as a target, not about getting a target in the first place. |
(.. there is no |
I mean the one inside the readme text (scroll down the page), under the headline Usage. |
I get the same behavior: Build will not generate code for anything in |
By the way, here's the "not in Apart from that I'm sure that there will be more conflicts than this one concerned with the treatment of |
Thanks for these links, they helped a lot. While the first one says
the third one says
No wonder is the lib folder somewhat special for Reflactable with Flutter. Thanks to your second link I could figure out that putting main.dart in the 'bin' folder works - even without the build.yaml file. In the lib folder I did not get it to work without the build.yaml file, but with it even the lib folder produced the main.reflectable.dart file. With that, I think I should get Reflectable to work in a real project. Thanks for your time! |
Cool, thank you! |
In my case, I was always getting |
@nareshdb What test library do you have in your dev_dependencies? In order for |
Your project is probably showing on your global dart installation, not on
make sure that your flutter and dart SDK show on the same path like this.
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
With a new installation of Flutter, following the reflectable tutorial on https://github.com/dart-lang/reflectable I get to the point were the command "pub run build_runner build lib" results in the error: "The Flutter SDK is not available".
For the reproduction as follows I removed my flutter path, and installed it fresh (but still have the plugins for IntelliJ IDEA and Android Studio). Note: Installation is working fine for other purposes as compiling sample app, etc.
How to reproduce:
a) cd ~/development
b) git clone -b beta https://github.com/flutter/flutter.git
c) export PATH=/Users/myname/development/flutter/bin:$PATH
d) flutter doctor
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-SE)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] iOS toolchain - develop for iOS devices (Xcode 9.2)
✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3)
[!] VS Code (version 1.24.1)
[✓] Connected devices (2 available)
New Flutter project in IntelliJ Idea
a) Choose SDK path: /Users/myname/development/flutter
b) Choose project location: ~/gitroot/PlayGround/reflectable_test
Follow reflectable tutorial (from https://github.com/dart-lang/reflectable):
a) Replace lib/main.dart with the main.dart from https://github.com/dart-lang/reflectable
b) Add "reflectable: any" to pubspec.yaml under dependencies
c) In main.dart, click on the now appearing "get dependencies"
(import 'main.reflectable.dart'; still shows an error)
d) On the command line:
cd /Users/myname/gitroot/PlayGround/reflectable_test/
pub run build_runner build lib
Result: shows "The Flutter SDK is not available."
The text was updated successfully, but these errors were encountered: