/dog

Minimal cat clone written in dart 🐢🎯

Primary LanguageDartGNU General Public License v3.0GPL-3.0

License People Stars Forks Watches Last Updated

Minimal cat clone written in dart 🐢🎯

What is this

dog is a rewrite of the cat utility in dart, written for learning purposes.

Inspiration

Wanted to learn about building CLIs using dart.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have installed the latest version of dart

Getting dog

To get dog, follow these steps:

git clone https://github.com/2kabhishek/dog
cd dog
flutter pub get
dart run bin/dog.dart -n README.md

Using dog

USAGE:
    dog [-nh] [path]

FLAGS:
    -h, --help              Prints help information.
    -n, --line-number       Prints file at $path with line numbers.

OPTIONS:
    path                    File to print using dog.

Example:
    dog -n README.md

How it was built

dog was built using dart and code.

Challenges faced

While building dog the main challenges were learning about dart conventions and the dart way of doing things.

What I learned

  • final vs const keywords -final should be used when we do not know the value at compile time -const should be used when we know values at compile time
  • Using Future for long running task
  • Using Platform.environment for fetching env values
  • Null checks and the ?? null aware operator
  • Reading args using ArgParser
  • Setting exitCodes using exitCode
  • Exception handling
  • Managing packages with pub
  • Dart tooling in general

Hit the ⭐ button if you found this useful.

More Info

Source | Website