A Open Source Dart Library

Related tags

Utilities dart_std
Overview

Pub Version GitHub issues GitHub stars

Introduction

Installation

Add the following to your pubspec.yaml:

dependencies:
  dart_std: any

After you import the library, you can use the extensions.

import 'package:dart_std/dart_std.dart';

2.toOrdinal(); // 2nd

Iterable

.joinToString()

Returns elements as String, can add prefix or suffix, separator. Similar to Kotlin joinToString()

final list = [0, 1, 2, 3, 4, 5];
list.joinToString(
    String? separator,
    String? prefix,
    String? postfix,
    int? limit,
    String? truncated,
    Function(D)? transform,
);

.toFlatten()

Combine nested collections to single collections.

final nestedList = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
final flatList = nestedList.toFlatten(); // [1, 2, 3, 4, 5, 6, 7, 8, 9]

Number types (int, double, etc)

toLikes()

Return K to B, now no need to convert likes or number manually.

10000.toLikes() // 10K
98000.toLikes() // 9.8K

.toOrdinal()

Returns an ordinal number of String type for any integer

2.ordinal();  // 2nd
452.ordinal();  // 452th

.plus() or plusOrNull()

Returns addition of two number

2.plus(8);  // 10
10.plusOrNull(20);  // 30

.minus() or minusOrNull()

Returns substraction of two number

8.minus(2);  // 6
20.minusOrNull(10);  // 10

.multiply() or multiplyOrNull()

Returns multiplication of two number

8.multiply(2);  // 16
20.multiplyOrNull(10);  // 200

.divide()

Returns division of two number

8.divide(2);  // 4
20.divide(2.5) // 8

String

.firstLetterCapitalize()

Returns a copy of the string having its first letter uppercased, or the original string, if it's empty or already starts with an upper case letter.

'deb'.firstLetterCapitalize(); // Deb
'Deb'.firstLetterCapitalize(); // Deb

.firstLetterLowercase()

Returns a copy of the string having its first letter lowercased, or the original string, if it's empty or already starts with a lower case letter.

'deb'.firstLetterLowercase(); // deb
'Deb'.firstLetterLowercase(); // deb

.prefix()

Returns a string with prefix added

var value = 'eb'.prefix('D'); 
print(value); // Deb

.suffix()

Returns a string with suffix added

var value = 'De'.suffix('b');
print(value); // Deb

.removePrefix(), .removeSuffix() and .removeSurrounding()

Remove a prefix, a suffix, or both from a given string:

final name = 'James Bond'.removePrefix('James '); // Bond
final milliseconds = '100ms'.removeSuffix('ms'); // 100
final text = '

Some HTML

'
.removeSurrounding(prefix: '

', suffix: '

'
); // Some HTML

.reversed

Returns a new string with characters in reversed order.

final emptyString = ''.reversed; // ''
final reversed = 'abc🤔'.reversed; // '🤔cba'

License

MIT License

Copyright (c) 2022 Debojyoti Singha

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You might also like...

A Pure Dart Utility library that checks for an Active Internet connection

This Code comes from https://github.com/komapeb/data_connection_checker * 🌍 Internet Connection Checker A Pure Dart Utility library that checks for a

Nov 25, 2022

Dart common utils library. DateUtil, EncryptUtil, JsonUtil, LogUtil, MoneyUtil, NumUtil, ObjectUtil, RegexUtil, TextUtil, TimelineUtil, TimerUtil.

Dart common utils library. DateUtil, EncryptUtil, JsonUtil, LogUtil, MoneyUtil, NumUtil, ObjectUtil,  RegexUtil, TextUtil, TimelineUtil, TimerUtil.

Dart common utils library. DateUtil, EncryptUtil, JsonUtil, LogUtil, MoneyUtil, NumUtil, ObjectUtil, RegexUtil, TextUtil, TimelineUtil, TimerUtil.

Dec 22, 2022

Reflectable is a Dart library that allows programmers to eliminate certain usages of dynamic reflection by specialization of reflective code to an equivalent implementation using only static techniques

Reflectable is a Dart library that allows programmers to eliminate certain usages of dynamic reflection by specialization of reflective code to an equivalent implementation using only static techniques. The use of dynamic reflection is constrained in order to ensure that the specialized code can be generated and will have a reasonable size.

Dec 31, 2022

A library for Dart that generates fake data

faker A library for Dart that generates fake data. faker is heavily inspired by the Python package faker, and the Ruby package ffaker. Usage A simple

Dec 18, 2022

A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

Oct 26, 2022

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.

Jan 4, 2023

This library contains methods that make it easy to consume Mpesa Api.

This library contains methods that make it easy to consume Mpesa Api. It's multi-platform, and supports CLI, server, mobile, desktop, and the browser.

Dec 15, 2021

Scribble is a lightweight library for freehand drawing in Flutter supporting pressure, variable line width and more!

Scribble is a lightweight library for freehand drawing in Flutter supporting pressure, variable line width and more!

Scribble Scribble is a lightweight library for freehand drawing in Flutter supporting pressure, variable line width and more! A

Dec 16, 2022

A library for YAML manipulation with comment and whitespace preservation.

Yaml Editor A library for YAML manipulation while preserving comments. Usage A simple usage example: import 'package:yaml_edit/yaml_edit.dart'; void

Dec 26, 2022
Owner
Debojyoti Singha
Flutter Developer, Android Developer, iOS Developer, Laravel Back-end Developer.
Debojyoti Singha
Provides API to generate Dart source code

DartWriter DartWriter provides API to generate Dart source code. It can make your job easier while developing flutter/dart tools. You can also generat

Ahmet ÇELİK 11 Oct 24, 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

null 4 Sep 12, 2022
An alternative random library for Dart.

Randt Randt library for Dart... Description Use Randt to get a random integer from a list, generate random integer in a specific range and generate ra

Bangladesh Coding Soldierz 3 Nov 21, 2021
The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

null 2 Oct 8, 2021
A comprehensive, cross-platform path manipulation library for Dart.

A comprehensive, cross-platform path manipulation library for Dart. The path package provides common operations for manipulating paths: joining, split

Dart 159 Dec 29, 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
Dart library for unescaping HTML-encoded strings

html_unescape A Dart library for unescaping HTML-encoded strings. Supports: Named Character References ( ) 2099 of them Decimal Character Referen

Filip Hracek 36 Dec 20, 2022
This is a dart library covering nearly 100% of the latest Planning Center public API.

Planning Center API for Dart Planning Center is an online platform for church management. It provides multiple apps for things like check-ins, service

null 1 Oct 6, 2022
A JMAP client library in Dart to make JMAP method calls and process the responses

JMAP Dart client A JMAP client library to make JMAP method calls and process the responses. We most notably use it to write the TMail Flutter applicat

LINAGORA 18 Dec 19, 2022
Library for help you make userbot or bot telegram and support tdlib telegram database and only support nodejs dart and google-apps-script

To-Do telegram client dart ✅️ support multi token ( bot / userbot ) ✅️ support bot and userbot ✅️ support telegram-bot-api local server ✅️ support tel

Azka Full Snack Developer:) 73 Jan 7, 2023