This repository gathers Dart 3 code examples coming from various websites - mostly from the Dart project - or written by ourself. In particular it includes several build scripts (Bash scripts, batch files, Make scripts) for experimenting with the Dart 3 language on a Windows machine. |
Ada, Akka, C++, COBOL, Dafny, Deno, Docker, Erlang, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.
☛ Dart 3 contains three major advancements. Read the document "Announcing Dart 3" for more details. Furthermore the document "Dart language evolution" describes changes and additions to the Dart language.
This project depends on the following external software for the Microsoft Windows platform:
Optionally one may also install the following software:
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\
as the installation directory for optional software tools (in reference to the/opt/
directory on Unix).
For instance our development environment looks as follows (December 2024) 1:
C:\opt\ConEmu\ ( 26 MB) C:\opt\dart-sdk\ (542 MB) C:\opt\Git\ (393 MB) C:\opt\VSCode\ (381 MB)
🔎 Git for Windows provides a Bash emulation used to run
git.exe
from the command line (as well as over 250 Unix commands likeawk
,diff
,file
,grep
,more
,mv
,rmdir
,sed
andwc
).
Directory structure ▴
This project has the following directory structure :
bin\ dartbyexample\{README.md, exceptions, ..} docs\ examples\{README.md, hello-dart, ..} macros-examples\{README.md, bird, userJson, ..} README.md RESOURCES.md setenv.bat
where
- directory
bin\
contains several batch files. - directory
docs\
contains several Dart related papers/articles (docs\README.md
). - directory
examples\
contains Dart examples grabbed from various websites (examples\README.md
). - directory
macros-examples\
contains Dart examples using macros and grabbed from various websites (macros-examples\README.md
). - file
README.md
is the Markdown document for this page. - file
RESOURCES.md
is the Markdown document presenting external resources. - file
setenv.bat
is the batch command for setting up our environment.
We also define a virtual drive – e.g. drive T:
– in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).
🔎 We use the Windows external command
subst
to create virtual drives; for instance:> subst T: %USERPROFILE%\workspace\dart-examples
In the next section we give a brief description of the batch files present in this project.
setenv.bat
2
We execute command setenv.bat
once to setup our development environment; it makes external tools such as git.exe
, make.exe
and sh.exe
directly available from the command prompt.
> setenv Tool versions: dart 3.6.0, make 4.4.1, code 1.96.0, git 2.47.1, diff 3.10, bash 5.2.37(1) > where git make sh C:\opt\Git\bin\git.exe C:\opt\Git\mingw64\bin\git.exe C:\opt\msys64\usr\bin\make.exe C:\opt\Git\bin\sh.exe C:\opt\Git\usr\bin\sh.exe
Command setenv -verbose
also displays the tool paths, the environment variables and the path associations (use subcommand help
to print the help messsage) :
> setenv -verbose Select drive I: for which a substitution already exists Tool versions: dart 3.6.0, make 4.4.1, code 1.96.0, git 2.47.1, diff 3.10, bash 5.2.37(1) Tool paths: C:\opt\dart-sdk\bin\dart.exe C:\opt\msys64\usr\bin\make.exe C:\opt\Git\bin\git.exe C:\opt\Git\usr\bin\diff.exe C:\opt\Git\bin\bash.exe Environment variables: "DART_HOME=C:\opt\dart-sdk" "GIT_HOME=C:\opt\Git" "MSYS_HOME=C:\opt\msys64" "VSCODE_HOME=C:\opt\VSCode" Path associations: I:\: => %USERPROFILE%\workspace-perso\dart-examples
Footnotes ▴
[1] Downloads ↩
-
In our case we downloaded the following installation files (see section 1):
ConEmuPack.230724.7z ( 5 MB) dartsdk-windows-x64-release.zip (201 MB) PortableGit-2.47.1-64-bit.7z.exe ( 41 MB) VSCode-win32-x64-1.96.0.zip (131 MB)
[2] setenv.bat
usage ↩
-
Batch file
setenv.bat
has specific environment variables set that enable us to use command-line developer tools more easily. - It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
-
For instance we can quickly check that the two scripts
Launch-VsDevShell.ps1
andVsDevCmd.bat
are indeed available in our Visual Studio 2019 installation :> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev* C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
-
Concretely, in our GitHub projects which depend on Visual Studio (e.g.
michelou/cpp-examples
),setenv.bat
does invokeVsDevCmd.bat
(resp.vcvarall.bat
for older Visual Studio versions) to setup the Visual Studio tools on the command prompt.