How to disable automatic running of "building flutter tool" and "pub upgrade"? - dart

So I decided to tinker around with Flutter.
Thus I downloaded the Flutter SDK (which contains the Dart SDK). I installed it (unpack, set bin to PATH).
Whenever I execute the dart command from the command line, it automatically triggers off building of the flutter tool as well as upgrading the pub tool, regardless of whether I want to or not. For example, as shown below:
(and mind you, when this happens, it also hogs a big chunk of the CPU % usage)
I wish to know how to disable this from happening. Either of these processes should be triggered only when I want them to be.

Related

Dart debug, how to save and load breakpoints?

I'm running dart with this command:
dart run --pause-isolates-on-start --observe --enable-vm-service=8181/0.0.0.0
With this command, can open on browser the dart native user interface to debug on
http://<ip>:8181/<authentication-code>
On debug page, is possible to set breakpoints and use them. But I don't find a way to save the break point to use on a future loading of dart debug.
Every time that I start the debug i have to set this breakpoints?
There is a way to save this break points to use on the future?
Not necessarily the answer you are looking for but could be seen as a workaround.
I have not tested this with VS Code, but if you are using IntelliJ (or Android Studio) with Dart plugin, you can essentially do remote debugging. So instead of using observatory to insert breakpoints, you can set them in your IDE which will then remember them and resend them to the Dart process when start debugging again.
If you go into "Run/Debug Configuration" and click + (Add), you can find "Dart Remote Debug":
As described in the dialog, when you are starting this "Run profile", you will be asked for the address to the Dart service protocol which your application should print out when started with Observatory / Dart DevTools enabled:
Unrelated notes
I have spend some time look at vm_service package which does provide ways to fetch breakpoints and adding breakpoints. But it is not really easy to map the breakpoints into something that can easily be persisted and later resent again. Some links you can use if you want to go for that journey:
https://pub.dev/documentation/vm_service/latest/vm_service/Isolate/breakpoints.html
https://pub.dev/documentation/vm_service/latest/vm_service/Breakpoint-class.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpoint.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpointAtEntry.html
https://pub.dev/documentation/vm_service/latest/vm_service/VmService/addBreakpointWithScriptUri.html

IntelliJ and Dart: restart daemon/dartvm

I'm doing Dart FFI development in IntelliJ to create bindings to a native library. While trying to get the bindings right, I seem to be messing up some internal memory of this library. After making corrections to my code, the library is still in an inconsistent state due to my earlier errors. This is because the updated code is run inside the same instance of the DartVM as earlier: IntelliJ doesn't restart it, it reuses it. The only way to get back to a consistent state is to restart IntelliJ, which is quite annoying.
Is there a way from inside IntelliJ to only restart the DartVM used to run my program? I've not been able to find any way...
It's not quite clear which Dart VM you want to restart.
There's only one long-living Dart VM, it's Dart Analysis Server, the tool from the Dart SDK that is responsible for code highlighting, completion, and other code insight features in the IDE editor. To restart it click the corresponding button in the Dart Analysis tool window, or open Find Action and search for 'Restart Dart Analysis Server'.
Speaking of running your application, IDE doesn't reuse any running VM. Which run configuration type do you use to start your app: Dart Command Line App or Dart Web App (see Run -> Edit Configurations)? Both have the 'Stop' button in the Run tool window in case you application doesn't terminate normally itself.
More details about the problem (probably with screenshots) will help us to give a better answer.

Passing command-line options to dartvm in flutter

I want to pass --enable-vm-service to the dart VM while running flutter but I didn't find any way to do it
simply running flutter --enable-vm-service returns
Could not find an option named "enable-vm-service".
I'm using android studio I would like to know if there a way to automatically pass the argument like this
if not command line will be enough.
The VM service runs automatically for Flutter, since Flutter uses it internally (eg. to send Hot Reload requests). If you run Flutter with --start-paused from the terminal for example, that will force it to print the VM service URL out:
To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on iPhone XS Max is available at: http://127.0.0.1:49303/
If you're running in VS Code, during a debug session there's a Dart: Open Observatory command that will launch the Observatory web app in your browser (this exposes the URL). There may be a similar button in IntelliJ/Android Studio, though I'm not sure.
You can also pass --observatory-port if you want to force a specific port:
flutter run --observatory-port 9999
In VS Code, you can add this to the args collection in your launch config (.vscode/launch.json). It'll probably also work in the args box shown in your screenshot for IntelliJ/Android Studio.

Can OpenCV libraries be called from a C++/CX app?

Is it technically possible (I don't think this would be restricted), and how do you go about it?
I got my little test app building fine, but when I run it I get a failure dialog.
The debug output is slightly more informative:
The thread 0xe4c has exited with code -1073741515 (0xc0000135).
The program '[3400] OpenCVTest2.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.
Then I created a Win8 Desktop app, which also built fine but failed to run.
MSVP100D.dll is part of the VC++ 2010 Redistributable which is not compatible with Win8. (Being a hacker I tried it anyway, the installer runs to completion - but the bits aren't installed.)
Is there a compiler flag I can try? Possibly a custom build of OpenCV would fix it, but that would be a last resort, and it might only fix the desktop app.
This guy shows an example of using OpenCV library for performing face detection in a Windows 8 Store app written using C++/CX:
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV322
Also, at the below post he also describes how the C++ Runtime works for Windows 8Store apps:
http://blogs.msdn.com/b/vcblog/archive/2012/09/28/10354327.aspx
MSVP100D is not a part of VC10 redist. Note the "D" at the end of its name. That package only includes release builds. Your release builds should work fine. But mixing libraries from different VC versions might get you in trouble. See this. Your best chance is to build from source with VC11.

How to force prebuild script to run at each compile

We currently use Delphi 2009 and GIT to develop an application. We have set up a prebuild script to generate a version number and build ID using information from git and compile this as a resource that is included in the project. The problem is that this script doesn't run on a regular compile. This means that the other developers can end up with a discrepancy between the actual version number and the number in the resource (especially when switching branches in git).
Since we use our software to make some critical calculations, we would like to use this build id to reproduce calculations and track down problems.
Other than trying to force my developers to frequently press shift-F9, how can I ensure that the the prebuild script gets run when necessary (ideally at each compile)?
Jason
UPDATE: It's true that the pre-build script gets run at each compile. The problem was that I expected to get a different result pressing F9 after making a tag in git, even though no code had changed.
We solved a similar issue by writing a custom IDE plugin which uses the IOTAIDENotifier50 interface. Specifically using the BeforeCompile method, to test some required project settings and also generate dynamic version information (VERSIONINFO resource). It gets called for every type of build (compile and build). We also generate a unique exe serial number and log everything, which helps us track down issues and is similar to your script. For completeness we have only done this in Delphi 2007 and Delphi XE.
Pre build actions do run before every compile.
You state in a comment that the actions sometimes don't run when you press F9. That makes sense because F9, or Run, only invokes a compile if source is deemed to have changed.
A BeforeCompile notifier plug in will behave in exactly the same way. Your solution is to make sure that you compile before running using Ctrl+F9.

Resources