Flutter: How to know the size of a flutter plugin - flutter

Adding many plugins can increase Flutter Apps size too much. But sometimes I find two similar plugins and if I have to choose them based on lesser size, how would I do it?
I couldn't find any tools for checking its size.

Flutter has a tool for measuring your app size it's documented here.
But the TLDR is:
Run flutter build apk --analyze-size --target-platform=android-arm
Run flutter pub global run devtools --appSizeBase=apk-code-size-analysis_04.json or whichever name the output of the previous command json was.
That should give you a look like this.
And then you can explore how much space each package, asset or whatever thats inside your app occupies.

Related

The Flutter app size is so big. How to reduce it?

Its starting app size is 17 MB. When developing the app, It's increasing the size from 17MB.
How to reduce the size of flutter given app (First project)
I used this method to get android app
flutter build apk --build-name=0.1 --build-number=2
According to the Official documentation of Flutter, they have various steps to analyze which part of your code is exactly taking much more space than needed.
They have a proper guide on that, to take you through analyzing the source code, testing the app size, and giving you the information of which file or dependency is taking more size and how much it is taking.
If you don't want to go through it, here are some common things by which it can reduce your app size.
Remove unused resources
Minimize resources imported from libraries
Compress PNG and JPEG files
Here's the official documentation if you want to read it.
Documentation Link
you can try the following
Compress PNG and JPEG files
reduce the use of container and replace them with SizedBox and Cards
Minimize resource imported from libraries
Remove unused resources
the fewer the screens the better
also you can split the apks while building it using this command
**flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
**
and always

having trouble setting up flutter in vs code

I have trouble in setting flutter and running an app on a real device in vs code. I want to run my apps on physical device and I do not want to use emulators. Is it going to be possible?
Yes, this is very possible. In fact, many flutter developers use physical devices in order to test features like Maps,Camera, etc. I always recommend following a video tutorial to set up environments for development. But you should try the following:
First of all, I recommend the flutter docs https://flutter.dev/docs/development/tools/vs-code to set up vscode.
After this, all you need does not have anything to do with VSCode any longer. You should check https://flutter.dev/docs/get-started/install/windows to connect a physical device.
Im not sure if you have already setup flutter on your machine to start with. If you haven't use this link how to install flutter
the next part is easy just install dart and flutter extensions in vscode.
walla!

How to set resource-id/content-desc in flutter app for automation using Appium?

To automate flutter app using Appium, we need to set the resource-id (for Android) and accessibility-Id/content-desc (for iOS) of any element/control in the flutter app. To get resource-id and accessibility-Id in the Appium tree view of flutter app, what should be done? Please help with possible solutions to achieve this.
Please refer below screenshot of Appium tree view which shows the missing resource-id.
Flutter version = 1.17.5
Please take a note that we have already tried "key" property of Widget for unique identification but it didn't work.
You can check this thread about Flutter support for Appium.
You can use semanticLabel field, but it still feels like Flutter driver for Appium is far from stable state.

Fuchsia - How to set up Dart pkgs on Flutter?

When I install Fuchsia for Flutter development on VS Code, I have to set up Dart pkgs. I don't have any idea about it. I'm lost. Exactly, implementing this https://fuchsia.googlesource.com/fuchsia/+/master/docs/development/languages/dart/mods.md
Any tutorials?
There is no need to install Fuchsia at all given that you are trying to build Flutter apps. While Fuchsia uses Flutter in some areas, the opposite is not true. There is no need for or reliance on Fuchsia if you would like to build flutter apps.
Open up Flutter.dev and click the blue "Get Started" button in the top right. Then follow the steps and you should be on your way.
Good luck.

Which Flutter default plugins are important?

I am relatively new to flutter and app development. I noticed that whenever a new flutter project is created, there are many default plugins pre-loaded into the project and this makes the app take up a minimum of 80 Mb. Could i get a summary on which plugins are actually important in order to run any app in general?
Flutter provides almost all the basic things like themeing, icons, routing etc out of the box.
You can have any other package if you need more functionality like fetching data from internet and so on.
The important thing is the size you see is the debug build which is large as it contains the VM for hot reload to work at such speed. When you build the release version it is the minimum version which goes for about <5Mb on bare-bone app.
Currently my debug app stands at around 80mb on emulator but the release version is < 6mb.
So to answer your question,
it is the debug size,not the final version
Flutter requires no extra plugin for an offline app with basic functionality. Core components + testing is provided out of the box.
Nothing useless is shipped by default,
NOTE: there is a section called dev_dependencies in pubspec.yaml which means the packages listed under this won't go into the release build and are only for development purpose.