How to use the official Flutter gallery - flutter

Im totally new to flutter, and would like to try out the official examples gallery: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery
I´ve installed Android studio and have the emulator running, which works great when i start the demo app from VS code.
Problem is, how do i fetch the gallery app, and load it onto the virtual device? The simple guide says I should run these two commands:
flutter packages get
flutter run --release
This does not work, as the terminal throws this error: "Release mode is not supported for emulators." If I instead run
flutter run --debug
it loads up the "You have pushed the button x this many times" standard demo app. And i really cant see how these two commands tells the terminal to get the flutter gallery.
I´ve also tried to change the flutter channel to dev, but this dosent help.
Flutter doctor says everything is OK.
So how do I you try out the official flutter gallery app?

You need to switch to the project directory of the gallery app first
cd your_flutter_install_dir/examples/flutter_gallery
flutter packages get
flutter run
If you have a real device connected (and the emulator closed) you can also use flutter run release

Related

Flutter App Installed and Done but not Disabled Open Option

I am working with flutter currently and everything was fine suddenly when I uninstalled the app from the device and rerun flutter run from the terminal it's suddenly not able to install the apk.
maybe when i including firebase in the flutter app then i facing this error.
Want to Know where is wrong my device or flutter code or something......
can show how the error appears in the debug console.
maybe you can try to follow on the documentation page here

How to deploy flutter example for the web?

https://pub.dev/packages/flutter_tex/example (want to run this code for Flutter Web)
Goal: Deploy flutter example on a simple web page for checking latex code output
Expected result: Simple web page where you type Latex on the left and it shows you rendered equations on the right
My experience: 1 day
Current installation: Flutter, Dart, Android Studio, Dart -> Able to "create new Flutter project"
What I have tried: Opened a new flutter project - pasted code in main.dart - did not work (no device device - need virtual device for web deployment?)
In order to run your Flutter project on the web, you must ensure that you have the latest version of Flutter (currently I am running v2.0.2). If you don't have the latest version, just run flutter upgrade in the terminal.
Secondly, you need to check whether the package that you are using also supports the web platform. You can check it by going into the "Scores" tab in the package.
Then, all you have to do is to run the command:
flutter run -d chrome
This will launch the flutter app in the Google chrome browser.

Stuck at Syncing files to device Chrome when trying to run a web project

I'm stuck at Syncing files to device Chrome when running the project, the same result from vscode terminal and command prompt, I only get a white screen on a google window and it doesn't seem to be in progress anymore, the steps that I made to create the project are :
flutter channel master
flutter upgrade
flutter config --enable-web
flutter create webapp
cd webapp
flutter run
I tried to check the console with F12 on the browser but it is empty.
I can run the project only in the release mode with flutter run --release, but it so exhausting to test on this mode seen that the hot reload takes so much time.
It is recommended to use beta channel for web support in flutter.
flutter channel beta

Flutter on VS Code run stuck on "Installing build\app\outputs\apk\app.apk..."

When I run my application using the VS Code Run and Debug, The app is installed on my device and is stuck on a white screen. Meanwhile in the editor, the VS Code notification is stuck on "Installing build\app\outputs\apk\app.apk..."
I've tried to run different flutter apps on the physical device but was still met with the same error. I've also tried to run the flutter example increment app, but to no avail. I also uninstalled and reinstalled the flutter sdk from the stable GitHub branch but that also did not work. I've also tried solutions from about 22 other questions with similar problems.
However, when I use flutter run from the command line, the app installs and launches on my phone, however, I'm unable to use the Flutter DevTools Inspector.
P.S I've been able to debug flutter apps on the device with the Flutter DevTools in the past.
As of Flutter v1.20.2, this problem has been resolved. The linked GitHub issue is here if you disagree about the problem being solved.
You'll need to end the flutter, dart and flutter processes. So in terminal do this:
killall adb
killall dart
killall flutter
Then reload vscode

Can't find recent announcement that the Flutter master branch can now enable flutter_web with command line operations

I should have bookmarked it, but the googles aren't being helpful.
There was a recent (past week or so) that the standard flutter command on the master branch can now eliminate the difference between Flutter and flutter_web repositories. This will be helpful for an upcoming demo.
Since the question is asking where the announcement link was, I bookmarked them. (Probably you don't need anymore though).
https://groups.google.com/forum/#!topic/flutter-announce/-LQPz3C3JAM
https://www.reddit.com/r/FlutterDev/comments/cl6cul/flutter_for_web_preview/
Edited:
I just tried the new approach and made some mistakes. So I would like to share more on this.
Steps at Flutter (Channel master, v1.9.1-pre.91):
First create a new project:
flutter create --web project
OR
$ flutter create project
$ cd project
$ flutter create --web .
Compile and Run the project with chrome (will launch chrome)
$ flutter run
That's all.
Another thing I found out: if you add the plugin which flutter web does not support, you can still pub get, compile successfully. The error will only happen when the unsupported code is triggered and then report some exceptions such as NoSuchMethodError: '<Unexpected Null Value>'.
Another Note: If you don't connect any mobile devices, flutter run by default will launch the chrome device. If you connect a mobile device, flutter run will pick the mobile device, compile and install it to your mobile device (at least it's the case in my env). So when you have both mobile and chrome devices, to launch the web case, simply execute flutter run -d chrome.
More links:
https://github.com/flutter/flutter/issues/34082
https://github.com/flutter/flutter/wiki/Building-a-web-application-with-Flutter