Hot restart for Dart console application with fast incremental compilation.

Related tags

Utilities dart cli tool
Overview

Pub Package License

Hot restart for Dart console application with fast incremental compilation.

Why do I need this?

If your console application compiles too long before running, and dart run, which is now supports incremental compilation, seems too slow.

Install

Use the dart pub global command to install this into your system.

$ dart pub global activate fire

Use

If you have modified your PATH, you can run this from any local directory.

$ fire

Otherwise you can use the dart pub global command.

$ dart pub global run fire

Here's an example of running a console application:

$ fire bin/cat.dart example/example.dart
> watching 'lib' folder.
> building done, took 0:00:00.000054
void main() {
  print('hello cat!');
}

> press r to restart and q to exit.

While running creates bin/cat.dill incremental kernel snapshot.

ToDo

Alternatives

Related

Comments
  • Changes

    Changes

    Here are the main changes:

    • some issues related to the restarting logic have been fixed.
    • a debug menu (lowercase d) has been added.
    • a help menu (lowercase h) has been added.
    • an auto restart mode on changes to the entry script has been added (see the help menu).
    • the root is now being watched and not just the lib directory.
    • now only changes to dart files are being registered.
    • preparations for automated tests have been added. I plan to finish that part in a future PR.
    • the working directory has been changed to be the directory of the entry script.
    opened by modulovalue 3
  • fire should gracefully handle compilation failures

    fire should gracefully handle compilation failures

    When the code that is being reloaded isn't valid Dart code fire will crash and not report any error messages.

    1. When code can't be compiled fire should expose the error messages that are being produced.
    2. When code can't be compiled fire should not crash and exit.

    A Stacktrace like this one is being thrown when fire crashes.

    Unhandled exception:
    Bad state: Expected exactly `602ff002-ed65-4145-851c-5d37f69bc08f` but got:
    [...].dart: Warning: Interpreting this as package URI, '[...].dart'.
    #0      FrontendServerClient.reject (package:frontend_server_client/src/frontend_server_client.dart:273:13)
    <asynchronous suspension>
    #1      main ([...]/fire.dart/bin/fire.dart.dart:124:3)
    <asynchronous suspension>
    
    opened by modulovalue 3
  • Some changes

    Some changes

    Hello @ykmnkmi,

    This PR is rather huge compared to the previous ones. I have some strong opinions on code style that have been enforced here. I'd be understanding If you'd prefer to rather stick to the existing style and copy the fix to #5 over manually.

    Notable non codestyle related changes are:

    • a lowercase s acts like a terminal clear + lowercase r.
    • newlines do not emit a warning.
    • #5 has been fixed.
    • milliseconds are output instead of Duration.toString.
    opened by modulovalue 1
  • Pubspec discovery

    Pubspec discovery

    An exception is thrown when a script is being run with fire x.dart outside of the root directory of a package.

    Error: Error when reading '.dart_tool/package_config.json': No such file or directory
    

    It would be great if fire could attempt to discover the package root by e.g. recursively walking up the parents and checking each directory for a pubspec.

    opened by modulovalue 0
  • Intellij ux issue

    Intellij ux issue

    I read once that the Dart plugin for intellij has special logic to save the current file when the focus changes to the terminal so that active changes are being registered by flutters hot reload feature.

    Unfortunately, intellij doesn't save the current file when focus changes to the Run window of intellij which is inconvenient for fire users for the same reason.

    A ticket should be opened on the jetbrains youtrack platform to request that intellij saves the current file when the focus changes to the Run window.

    opened by modulovalue 0
Owner
Olzhas Suleimen
Python ❤️ Dart. Math, music, space & stars. Full stack & Desktop developer.
Olzhas Suleimen
A Dart testing utility for asserting that some code emits a compilation error.

A Dart testing utility for asserting that some code emits a compilation error.

Remi Rousselet 32 Dec 11, 2022
A cli tool to run Flutter applications and auto hot reload it when files are changed

Dashmon A minimalistic CLI tool to run Flutter applications and auto hot reload it when files are changed. It will watch changes your application code

Erick 31 Oct 6, 2022
The convenient enum of 256 colors for console

The convenient enum of 256 colors for console. Console Color gives the color code for the console an easily recognizable name.

Kato Shinya 1 Mar 2, 2022
A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library.

polylabel Dart port of https://github.com/mapbox/polylabel. A fast algorithm for finding polygon pole of inaccessibility implemented as a Dart library

André Sousa 2 Nov 13, 2021
Functional programming essentials for Dart. Tail call optimization, partial application, memoization, and more.

Pure is a Dart package that brings functional programming essentials through extension methods. It offers function composition/pipes, function memoization, partial application, and recursion trampolines.

Yakov Karpov 10 Oct 27, 2022
Dart wrapper via dart:ffi for https://github.com/libusb/libusb

libusb Dart wrapper via dart:ffi for https://github.com/libusb/libusb Environment Windows(10) macOS Linux(Ubuntu 18.04 LTS) Usage Checkout example Fea

Woodemi Co., Ltd 28 Dec 20, 2022
Extensible Dart interpreter for Dart with full interop

dart_eval is an extensible interpreter for the Dart language, written in Dart. It's powered under the hood by the Dart analyzer, so it achieves 100% c

Ethan 169 Dec 28, 2022
Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.

Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.

Google 905 Jan 2, 2023
A flutter utility to easily create flavors in your flutter application

Flutter Flavorizr A flutter utility to easily create flavors in your flutter application Getting Started Let's start by setting up our environment in

Angelo Cassano 268 Jan 1, 2023
A flarum (flarum.org) application, Seamlessly uses all the flarum sites of your added.

fluam_app A flarum (flarum.org) application, Seamlessly uses all the flarum sites of your added. Supported platforms Android (6.0+) ios (64bit only) L

Fluam 45 Nov 7, 2022
A BMI calculator application using Flutter.

BMI Calculator Purpose Maintaining a healthy weight is important for overall health and can help to prevent and control many diseases and conditions.

Srijan Kumar Gupta 3 Apr 21, 2022
An application built using flutter that works as destiny checker, whether our mind wish is as we desire or not with 8 different option.

magic_8_ball_utter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you s

dev_allauddin 3 Feb 3, 2022
An android application built using Flutter that computes the Body Mass Index of person and suggestion to carry ,by taking Inputs (Weight, Height, and Age), Built using Flutter

BMI Calculator ?? Our Goal The objective of this tutorial is to look at how we can customise Flutter Widgets to achieve our own beautiful user interfa

dev_allauddin 7 Nov 2, 2022
An application built using Flutter that holds a static personal/professional informations related to me in the form of card.(Digital Visiting Card)

mi_card_flutter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you star

dev_allauddin 3 Feb 3, 2022
Dependency Injection is a great design pattern that allows us to eliminate rigid dependencies between elements and it makes the application more flexible

GetX lib DI pattern Dependency Injection is a great design pattern that allows us to eliminate rigid dependencies between elements and it makes the ap

Trương Việt Hoàng 4 Feb 1, 2022
A simple command-line application to generate simple folder and file structure for Flutter Applications

Kanza_cli is a simple command line tool to generate folder and file structure for your Flutter apps. To use it, you should do the followings: 1. First

Kanan Yusubov 9 Dec 16, 2022
A mobile map based application to help people everywhere around the world get help

Wonder This is a mobile application made by flutter. The application is called "Wonder" because it will help people everywhere around the world to get

Sara Nersisian 1 Dec 2, 2021
Redux Compact is a library that aims to reduce the massive amount of boilerplate that follows maintaining a Flutter Redux application.

Redux Compact Redux Compact is a library that aims to reduce the massive amount of boilerplate that follows maintaining a Flutter Redux application. T

Ómar Óskarsson 9 Apr 8, 2022
Application that simplifies the search process in several supermarkets, allowing the user to define the shopping list in a few minutes.

economiz Application that solves the price research process in different supermarkets, facilitating and simplifying this process for the user. Getting

Guilherme Henrique 1 Dec 29, 2021