Simple Dart calculator for use in a CLI

Overview

Dart-calculator

Simple Dart calculator for use in a CLI

Related to the Medium article: Building a Simple CLI Calculator App in Dart

Overview

This application allows basic calculator functionality when run from a CLI. Recursion is used to continue functionality, and the user is allowed to exit at anytime via simply typing exit.

The calculator can add, subtract, multiply, expontentiate, and divide.

Setup and Rationale

All numerical inputs are of the double datatype as I wanted to account for the possiblity of decimal numbers. The first number received is the one that has operations performed on it (i.e. it is subtracted from, divided from.)

To give myself a little variety, I used Math.pow for the exponentiation function. It will just raise the first number by the second number. Additionally, typecasting is used to account for large numbers

To receive inputs, Scanner is used. A check for the word 'exit' is first performed, and if not, the input is converted to a double. This means, however, there is the possibility for an error if the user types in other non-numerical characters (See Future Considerations)

Future Considerations

The incorporation of regular expressions to verify inputs would be a great improvement to this app and can be solved by the Pattern and Matcher classes. However, I didn't want to incorporate them at this point as this repo's purpose is to be used as a guide to those new to Dart.

You might also like...

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli

Sentry Dart Plugin A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli. For doing i

Jan 4, 2023

⚒️ A monorepo containing a collection of packages that provide useful functionality for building CLI applications in Dart.

⚒️ A monorepo containing a collection of packages that provide useful functionality for building CLI applications in Dart.

⚒️ Dart CLI Utilities A monorepo containing a collection of packages that provide useful functionality for building CLI applications in Dart. Document

Oct 17, 2022

Get google api credentials - A Dart CLI app to obtain credentials for accessing Google APIs

get_google_api_credentials A Dart CLI app to obtain credentials for accessing Go

Jan 28, 2022

A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances.

h5ai scraper A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances. Usage This tool requires the Dart SDK. It can be

Jan 4, 2023

A Very Good Dart CLI Template created by the Very Good Ventures Team 🦄

A Very Good Dart CLI Template created by the Very Good Ventures Team 🦄

Very Good Dart CLI Developed with 💙 by Very Good Ventures 🦄 A Dart CLI template created by the Very Good Ventures Team. Generated by the Very Good C

Dec 15, 2022

Simple calulator - A Simple Flutter Calculator project

Simple calulator - A Simple Flutter Calculator project

simple_calulator A Simple Flutter Calculator project. Screen Shot

Sep 13, 2022

A simple yet elegant tip calculator created using flutter framework and dart language.

CAL- TIP, A TIP CALCULATOR APPLICATION A simple yet elegant tip calculator created using flutter framework and dart language. As the name suggests, th

Dec 26, 2021

Simple calculator made with flutter and dart.

Simple calculator made with flutter and dart. Its design takes after the iOS calculator but includes a light theme, as well as improvements and operations I believe the iOS calculator needs.

Jan 3, 2022

Command Line Interface (CLI) for Lucifer

Lucy Command Line Interface (CLI) for Lucifer. Installation Activate command line from your terminal with this command. pub global activate lucy Usage

Dec 16, 2021
Comments
  • adding a Delay

    adding a Delay

    https://github.com/jeanluc243/dart-calculator/blob/a4ba76cb272f8fb85ed0500033dab2f7011b96fa/calc.dart#L48-L53


    This issue was generated by todo based on a TODO comment in a4ba76cb272f8fb85ed0500033dab2f7011b96fa. It's been assigned to @jeanluc243 because they committed the code.
    todo :spiral_notepad: 
    opened by todo[bot] 0
Owner
Jean Luc Kabulu
❯🦊 @googledevs ❯⚔️ @evoludata Dev ❯👨‍🏫 Teacher at @Udemy & @YouTube ❯🥑 OSS Developer Advocate ❯📣 @TEDxBdMsiri Licensee ✍️ @Medium ❯ 🎩 FT OpenSourcer
Jean Luc Kabulu
Flutter-calculator - A flutter calculator appliacation which is made with dart

A simple calculator A simple calculator app made with Flutter Screenshot This pr

Munem Sarker 1 Jan 23, 2022
Love-Calculator-Flutter - A Love Calculator Flutter app created for learning basic stuffs in Dart

Love Calculator The same old Love Calculator ,but in flutter NB A simple flutter

Adithya Krishnan 3 Nov 14, 2022
BMI calculator app - BMI calculator app written with dart language using flutter

BMI_calculator_app This app is written with dart language using flutter framewor

Elham Madjidi 0 Feb 5, 2022
A simple dart CLI to do various file conversion

Dart Converters A simple dart CLI to do various file conversion Ever get tired from changing old code to follow the current standards i.e snake_case t

Nour Magdi 1 Apr 18, 2022
BMI Calculator - A Body Mass Index Calculator inspired by the beautiful user interface designs.

BMI Calculator A Body Mass Index Calculator inspired by the beautiful user interface designs. A multi screen app with simple functionality but full-on

Vedant Karale 0 Dec 2, 2021
Flutter-calculator - An elegant calculator app written in Flutter

Elegant Calculator A simple and elegant Calculator app developer in Flutter. Preview Getting Started This project is a starting point for a Flutter ap

Shubham Soni 103 Oct 21, 2022
Age-Calculator - Age Calculator For Flutter

Age-Calculator(Contributed by YEASEEN AHMED)

CPAD-Gazipur 2 Oct 9, 2022
Age-Calculator-Lambda - Age Calculator Lambda With Flutter

Age-Calculator-Lambda(Contributed by YEASEEN AHMED)

CPAD-Gazipur 4 Nov 13, 2022
Body-Mass-Index-Calculator - Body Mass Index Calculator Using Flutter

Body-Mass-Index-Calculator Image Video Presentation bandicam.2022-02-18.00-33-22

Harsh Vardhan 3 Aug 15, 2022
Flutter Version Management: A simple cli to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. Features: Configure Flutter SDK version per project or globally Ability t

于飞 242 Dec 18, 2022