Dart: Get bytes from Flutter-Canvas without opening Flutter App - flutter

Background
I am developing a pure Dart command line tool, which combines images from files.
Think creating NFTs by stacking images.
Using the pure Dart image library is slow, it takes about 11-20 seconds for one image sized 3000 x 3000.
Tried
Adding Flutter and using Flutter-Canvas to increase performance does not allow me to compile a Dart command line EXE.
I tried flutter build windows but the result always does open a window / head. And it does not work, just sits there.
Questions regarding possible solutions
Is there a way to combine images more efficently than image?
Is there a way to create a Dart command line EXE which uses Flutter-Canvas as a library?
Flutter Tests run headless; is there a way to imitate that behaviour und thus run Flutter-Canvas headless?

Flutter Tests
One approach would be to hijack Flutter Tests, but these cannot be turned into a redistributable app or command:
https://andrewzuo.com/headless-flutter-apps-39168d20277b
https://andrewzuo.com/passing-arguments-to-headless-flutter-apps-773435c6eae6
Command Line Package
A different apporach would be to use this package, which modifies code in the ./windows folder:
This plugin allows you to run a flutter windows app in gui, or
commandline mode. io.dart is used to access stdout and stderr
https://pub.dev/packages/commandline_or_gui_windows

Related

Dart/Flutter Debug Console Issue on Visual Studio Code

I'm trying to print('hi') inside Visual Studio Code's Debug Console using Dart/Flutter.
Whenever I perform a restart, it works just fine. As you can see in the debug console it prints: I/flutter: hi
Performing a restart takes up to one minute of loading time. This isn't very ideal.
Ideally I would prefer that print() displays on the console whenever I perform a hot reload (as this only a takes a few seconds).
Any help would be greatly appreciated!
You are running a flutter app. That's quite expensive even if your "app" is only a print. Depending on your machine, reloading or even restarting can take a while.
EDIT since the whole debugging setup required for flutter apps is run too.
If you want to run dart code only, consider creating a dart project without flutter.

How to detect whether the Dart code is running in pure-Dart environment or running inside Flutter?

I have some Dart code, and inside that code, I want to know whether it is running as pure Dart or running inside the Flutter environment. How do achieve this?
I guess this should be very simple, but interestingly a search does not reveal any solutions...

Android Studio - multi-line additionalArgs?

I'm trying to build a Flutter app in Android Studio. We're using VSCode with quite many dart-define's in .vscode\launch.json. In Android Studio, I think, we should use Build Configuration - Additional run args.
The problem with it, however, is that it's a single line edit and it's too cumbersome to manage the many defines that in VSCode are easily accessible via regular text editor
Is there a better way to do this? Like, reference an external file and load the defines from there?
The IDE saves the entire string as an xml attribute in workspace.iml, so I can't just edit that as well.
In that window, you will see a small expansion array on the far end of the textbox. You should click it to get a multi - line sort of view for the args

VS Code Extension and command line tool

I would like to create a command line tool (CLI), that can be run from the terminal, that will do some stuff in the background, then open a WebView of the results in VS Code. I'm unsure of whether or not this would require 2 components or can be completely run inside of a VS Code Extension. If running separately, I would assume there would need to be some communication layer between the command line process and the extension itself. What is the best approach?
An example of the command:
hydra generate app
The WebView would show the results of the process and a TreeView (HTML) of the results. The HTML would need to be interactive but I have the HTML working as standalone for now.

Script to open two applications on start up and snap them with one being 80% screen and the other being 20% in Windows 8.1 Desktop

I am not a programmer rather a designer but have been trying to write a .bat file for weeks to have two applications, which I specify, open automatically and snap to a scale of 80% left hand side and 20% for the second app on the right hand side. I have looked into multiple options without having any luck. Currently, I can create a script to open two files and automate key strokes to have them snap 50-50%, however I really need the 80-20% screen real estate. Any chance anyone would be able to help me out?
I am currently trying to use PowerShell with WASP (http://wasp.codeplex.com/) but scripting in this is beyond my knowledge. Many thanks!
You should try UI Automation PowerShell Extensions.
It supports testing for Metro Apps. The initial setup is a bit tedious (as described in the link provided) but it is well worth it. You have a UI action recording tool UIAutomationSpy which records all of your actions and generates corresponding PowerShell scripts. You can then run these scripts using the UIARunner tool.
With respect to the current problem, you could simulate the steps for snapping the apps using the recorder. You could then create a task which runs a batch file (executing the concerned script) on startup.