basic_utils 1.7.0 copy "basic_utils: ^1.7.0" to clipboard
basic_utils: ^1.7.0 copied to clipboard

outdated

Common util classes providing a solution for different situations.

Basic Utils #

A dart package for many helper methods fitting different situations.

Table of Contents #

  1. Preamble
  2. Install
  3. Import
  4. Util Classes
  5. Changelog
  6. Copyright and license

Preamble #

This package is also part of the EZ Flutter Framework.

Install #

pubspec.yaml #

Update pubspec.yaml and add the following line to your dependencies.

dependencies:
  basic_utils: ^1.7.0

Import #

Import the package with :

import 'package:basic_utils/basic_utils.dart';

Util Classes #

The package contains different classes. Each class contains methods that provide a solution for certain problems.

StringUtils #

Helper class for String operations.

String defaultString(String str, {String defaultStr = ''});
bool isNullOrEmpty(String s);
bool isNotNullOrEmpty(String s);
String camelCaseToUpperUnderscore(String s);
String camelCaseToLowerUnderscore(String s);
bool isLowerCase(String s);
bool isUpperCase(String s);
bool isAscii(String s);
String capitalize(String s);
String reverse(String s);
int countChars(String s, String char, {bool caseSensitive = true});
bool isDigit(String s);
bool equalsIgnoreCase(String a, String b);
bool inList(String s, List<String> list, {bool ignoreCase = false});
bool isPalindrome(String s);
String hidePartial(String s, {int begin = 0, int end, String replace = "*"});
String addCharAtPosition(String s, String char, int position,{bool repeat = false});

DomainUtils #

Helper class for operations on domain names.

bool isDomainName(String s);
bool isSubTld(String tld, String subTld);
bool isSubDomain(String s);
bool isSubDomainOf(String sub, String domain);
bool isCCTLD(String s);
bool isNGTLD(String s);
bool isTld(String s);
bool isGTLD(String s);
List<String> splitDomainName(String domainName);
Domain getDomainFromUrl(String url);
Domain parseDomain(String domainName);

EmailUtils #

Helper class for operations on email addresses.

bool isEmail(String s);
EmailAddress parseEmailAddress(String s);

MathUtils #

Helper class for simple math operations like calculating circular area or converting length units.

double calculateCircumference(double radius);
double calculateCircularArea(double radius);
double calculateCircleDiameter(double radius);
double calculateSquareArea(double a, {double b});
double convertUnit(double value, LengthUnits sourceUnit, LengthUnits targetUnit);
double calculateMixingTemperature(double mA, double tA, double mB, double tB,{double cA, double cB});
num mean(List<num> l);

HttpUtils #

Helper class for simple http operations like sending requests.

Future<Map<Response> getForFullResponse(String url, {Map<String, dynamic> queryParameters, Map<String, String> headers});
Future<Map<String, dynamic>> getForJson(String url, {Map<String, dynamic> queryParameters, Map<String, String> headers});
Future<String> getForString(String url, {Map<String, dynamic> queryParameters, Map<String, String> headers});
Future<Map<Response> postForFullResponse(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<Map<String, dynamic>> postForJson(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<String> postForString(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<Response> putForFullResponse(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<Map<String, dynamic>> putForJson(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<String> putForString(String url, String body, {Map<String, String> queryParameters, Map<String, String> headers});
Future<Response deleteForFullResponse(String url, {Map<String, String> queryParameters, Map<String, String> headers});
Future<Map<String, dynamic>> deleteForJson(String url, {Map<String, String> queryParameters, Map<String, String> headers});
Future<String> deleteForString(String url, {Map<String, String> queryParameters, Map<String, String> headers});
Map<String, dynamic> getQueryParameterFromUrl(String url);
String addQueryParameterToUrl(String url, Map<String, dynamic> queryParameters);

DnsUtils #

Helper class for lookup resource records. Uses google dns resolver api.

Future<List<RRecord>> lookupRecord(String name, RRecordType type,{bool dnssec = false});

SortUtils #

Helper class for sorting lists. Implementation of different sorting algorithms.

List quickSort(List list);
List bubbleSort(List list);
List heapSort(List list);

ColorUtils #

Helper class for color operations.

int hexToInt(String hex);

Changelog #

For a detailed changelog, see the CHANGELOG.md file

MIT License

Copyright (c) 2019 Ephenodrom

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 NONINFRINGEMENT. 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.

319
likes
0
pub points
98%
popularity

Publisher

unverified uploader

Common util classes providing a solution for different situations.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, json_annotation, logging

More

Packages that depend on basic_utils