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

Sep 5, 2022

⚒️ 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

Sep 14, 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

May 3, 2022

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

Aug 26, 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

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

A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

Sep 23, 2022

A CLI to help with using FlutterFire in your Flutter applications.

A CLI to help with using FlutterFire in your Flutter applications.

FlutterFire CLI Documentation • License A CLI to help with using FlutterFire in your Flutter applications. Local development setup To setup and use th

Sep 13, 2022
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 2 Mar 22, 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 Aug 24, 2022
Age-Calculator - Age Calculator For Flutter

Age-Calculator(Contributed by YEASEEN AHMED)

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

Age-Calculator-Lambda(Contributed by YEASEEN AHMED)

CPAD-Gazipur 3 Feb 9, 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

于飞 240 Sep 20, 2022