Dart's native integers in custom bitwidth integer format

Overview

integer

Dart's native integers in custom bitwidth integer format. There are getters for int, to get the appropriate datatypes you need.

i2, i4, i8, i16, i32 and i64 are the standard signed integer datatypes and u1, u2, u4, u8, u16, u32, u63 are the standard unsigned integer datatypes exposed by this library. If you want to use a custom bit-width integer format, you can use the ix and ux datatypes.

All operations and functions can be seamlessly used with other integer types, and native int, double datatypes. Remember that all integer datatypes provided do not actually allocate different bit-widths in memory. This is due to the limitation of Dart's VM.

/// Use the constructor
i32(32423445435)
/// or use getters
32423445435.i_32 // -1936292933

Remember to enclose negative integer literals like -34644 or -89 in parenthesis to tell Dart that the getters should be called for the entire literal. Like this

(-98723447).u_16 // 39305

Operations

All operations are compatible with native int and are also compatible with all signed and unsigned integer datatypes.

u16 a = (-982342623).u_16;
print('Value of 16-bit unsigned integer a is $a');
print('Addition int: ${a + 862} double: ${a + 862.343}');
print('Subtraction int: ${a - 36} double: ${a - 36.909}');
print('Multiplication int: ${a * 6} double: ${a * 6.2345}');
print('Division int: ${a / 6} double: ${a / 6.2345}');
print('Euclidean Modulo int: ${a % 8} double: ${a % 8.923}');

Bitshift operations only support integer and int values

print('Left Shift: ${a << 3}');
print('Right Shift: ${a >> 9}');
print('Triple Shift: ${a >>> 5}');

If double values are used in operations of integer variables, the value is truncated after the operation.

Custom Bit-Width

Provide a custom bit-width to convert the integer to that format using ix and ux datatypes

/// 22-bit Signed Integer
(-4567233343).iX(22) // 363713

/// 48-bit Unsigned Integer
(-4567233343).uX(48) // 281470409477313
You might also like...

A simple integer stream example for flutter

A simple integer stream example for flutter

Ejemplos Stream Simple Stream ejemplo 1 muestra el uso de StreamBuilder con un s

Dec 22, 2021

Generate random data(string, integer, IPs etc...) using Dart.

Generate random data(string, integer, IPs etc...) using Dart.

Generate random data using Features API provides generation of: Integers in any range of numbers Strings with various characters and length Colors rep

Apr 17, 2022

react-native native module for In App Purchase.

react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

Dec 31, 2022

dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Jul 11, 2022

how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

Nov 26, 2022

Flutter native ads - Show AdMob Native Ads use PlatformView

Flutter native ads - Show AdMob Native Ads use PlatformView

flutter_native_ads Flutter plugin for AdMob Native Ads. Compatible with Android and iOS using PlatformView. Android iOS Getting Started Android Androi

Dec 20, 2022

A Dart library to parse Portable Executable (PE) format

pefile A Dart library to parse Portable Executable (PE) format Usage A simple usage example: var pe = pefile.parse('C:\\Windows\\System32\\notepad.exe

Sep 12, 2022

The Flutter app demonstrates displaying data in a weekly format.

The Flutter app demonstrates displaying data in a weekly format.

Flutter weekly chart The Flutter app demonstrates displaying data in a weekly format. I came across this kind of screen in the app that I have been wo

Jan 2, 2023

The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that frozened column/row,loading more, high performance and better experience in TabBarView/PageView.

The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that frozened column/row,loading more, high performance and better experience in TabBarView/PageView.

flex_grid Language: English| 中文简体 The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that f

Nov 8, 2022

A Flutter package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) dates.

A Flutter package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) dates.

A Flutter package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) dates.

Dec 21, 2022

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

Dec 31, 2022

A simple dart package to convert large numbers to a human readable format. 1278 to 1.2K instead, for example.

A simple dart package to convert large numbers to a human readable format. 1278 to 1.2K instead, for example. Features Represents large numbers in ter

Oct 8, 2022

A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber

A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber

Intl Phone Number Input A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumb

Dec 11, 2022

Flutter Currency Format Converter Library

Save your time on a little logic converting a currency from integer to string or string to integer. if you intrested to contribute to our little proje

Dec 7, 2021

A simple and customizable flutter package for inputting phone number in intl / international format

A simple and customizable flutter package for inputting phone number in intl / international format

Intl Phone Number Input A simple and customizable flutter package for inputting

Jul 21, 2022

MoneyTextFormField is one of the flutter widget packages that can be used to input values in the form of currencies, by displaying the output format in realtime.

MoneyTextFormField is one of the flutter widget packages that can be used to input values in the form of currencies, by displaying the output format in realtime.

MoneyTextFormField MoneyTextFormField is one of the flutter widget packages that can be used to input values in the form of currencies, by displaying

Jan 1, 2023

A Flutter App To Download Videos From YouTube In Mp3 Format

A Flutter App To Download Videos From YouTube In Mp3 Format

Flutter_YouTube_MP3 App A Simple app To Download mp3 Videos From YouTube ❤️ Found this project useful? If you found this project useful, then please c

Dec 19, 2022

PhoneIntl - A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber

PhoneIntl - A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber

Intl Phone Number Input A simple and customizable flutter package for inputting

Jan 29, 2022

Rich text editor for Flutter based on Delta format (Quill fork)

Visual Editor Visual Editor is a Rich Text editor for Flutter originally forked from Flutter Quill. The editor is built around the powerful Delta docu

Jan 7, 2023
Owner
Aldrin's Art Factory
A platform to express the art inside you. Brought to you by Aldrin Mathew
Aldrin's Art Factory
A Dart library to parse Portable Executable (PE) format

pefile A Dart library to parse Portable Executable (PE) format Usage A simple usage example: var pe = pefile.parse('C:\\Windows\\System32\\notepad.exe

null 4 Sep 12, 2022
This package binds to Cronet's native API to expose them in Dart.

Experimental Cronet Dart bindings This package binds to Cronet's native API to expose them in Dart. This is an HTTP Client Package with almost the sam

Google 103 Dec 9, 2022
custom assets loaders for easy_localization

Custom assets loaders for Easy Localization package Supported formats JSON (JsonAssetLoader) CSV (CsvAssetLoader) HTTP (HttpAssetLoader) XML (XmlAsset

Aye7 34 Nov 11, 2022
Flutter custom utils

Get the MediaQuery size getSize(context) Make a responsive gridview by using bot

The Essential Utilities 0 Feb 23, 2022
NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.

NumberPicker NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners. Example: (See example for more)

Marcin Szałek 273 Nov 4, 2022
Flutter Number Picker is a custom widget designed for choosing an integer or decimal number by using add and minus buttons

Flutter Number Picker is a custom widget designed for choosing an integer or decimal number by using add and minus buttons. Getting Started Head to /p

Vũ Phương 2 Jul 4, 2022
Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

Chance Dart Random generator helper for Dart Homepage • Documentation Overview Chance Dart is a free Open Source project that lets you create random s

Ayotomide 55 Dec 27, 2022
Scoreboard successor of dart-o-mat-3000. Darts games score keeping application

Project This is the successor of my previous project Dart-O-Mat 3000. I chost to rewrite it using go as a backend language and svelte as a frontend fr

DaScr 22 Oct 7, 2022
Sample code for "A Game of Darts" tutorial

These are small Dart samples used by the online Dart tutorials. Each directory in this repo represents a tutorial. The homepage field in each pubspec

Dart 190 Sep 17, 2022
A simple flutter app to manage the score in a match of darts

DartCounter An application to keep track of a Dart match It is currently made for Windows-only use, but you can build it for any Platform if you want,

bafto 1 Jun 1, 2022