🪟 Windows TippsMichael Linden wechselt zu Coda Audio Deutschland(15.09.2026 um 18:14 Uhr)
🤖 Android TippsMichael Linden wechselt zu Coda Audio Deutschland(15.09.2026 um 18:14 Uhr)
🕵️ SicherheitslückenCVE-2026-82431 | Apache Storm Nimbus authorization (CNNVD-2026-98874501)(15.09.2026 um 18:28 Uhr)
🪟 Windows TippsMichael Linden wechselt zu Coda Audio Deutschland(15.09.2026 um 18:14 Uhr)
🤖 Android TippsMichael Linden wechselt zu Coda Audio Deutschland(15.09.2026 um 18:14 Uhr)
🕵️ SicherheitslückenCVE-2026-82431 | Apache Storm Nimbus authorization (CNNVD-2026-98874501)(15.09.2026 um 18:28 Uhr)

🔧 Programmierung 🕛 vor 4 Monaten 2 Min Lesezeit
0

Dart Library and CLI Project

↗ Quelle (dev.to)
🗣️ Stimme:

Creating a library is great, in particular if one wants to avoid doing duplicated code, but the library can also be released with a command line interface for simple tasks (or tests).



A Dart package (or library) can be created using dart create command, the --template flag define which kind of skeleton will be used for the project, in this case, it will be a package project.




CODE
dart create --template package mycli






The tree generated is straightforward and contains only the required files to do a successful build.




CODE
$ tree
.
├── analysis_options.yaml
├── CHANGELOG.md
├── example
│   └── mycli_example.dart
├── lib
│   ├── mycli.dart
│   └── src
│   └── mycli_base.dart
├── pubspec.lock
├── pubspec.yaml
├── README.md
└── test
└── mycli_test.dart

5 directories, 9 files






Let try to run the code with dart run.




CODE
$ dart run
Resolving dependencies in `/home/user/tmp/dart/mycli`...
Downloading packages...
Got dependencies in `/home/user/tmp/dart/mycli`.
Could not find `bin/mycli.dart` in package `mycli`.






It fails. Why? Because no executables entry-points have been defined somewhere. Let creates ./bin/main.dart file, simply containing a main() function.




CODE
mkdir bin
cat > bin/mycli.dart << EOF
void main() {
print("hello");
}
EOF






Now, we can try to run it. It should not fail.




CODE
$ dart run
hello






It works! If you want to define custom command line application, a list of on Unsplash

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
2 Quellen
Michael Linden wechselt zu Coda Audio Deutschland
1 Quelle
Razer Prio review: The first mobile controller I've actually wanted to carry everywhere
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Dart Library and CLI Project

Thematisch verwandte Begriffe: Dart, Library, Project · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...