A dart package for many helper methods fitting different situations.
As this package is written in pure Dart, it can be used on all platforms on which dart is currently running. This includes the use of frameworks like Flutter, Angular Dart and many more. This package can also be used for command line tools or rest services compiled with dart2native.
Note: Feel free to contribute by creating pull requests or file an issue for bugs, questions and feature requests.
Update pubspec.yaml and add the following line to your dependencies.
dependencies:
flutter_my_utils: ^0.0.1
Import the package with :
import 'package:flutter_my_utils/flutter_my_utils.dart';
The package contains different classes. Each class contains methods that provide a solution for certain problems.
Helper class for Uri.
Future<void> makePhoneCall(String phoneNumber);
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, {bool allWords = false});
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});
List<String> chunk(String s, chunkSize);
String pickOnly(value, {int from = 1, int to = -1});
String removeCharAtPosition(String value, int index);
String removeExp(String value, String pattern,{bool repeat = true,bool caseSensitive = true,bool multiLine = false,bool dotAll = false,bool unicode = false});
String truncate(String value, int length, {String symbol = '...'});
String generateRandomString(int length,{alphabet = true,numeric = true,special = true,uppercase = true,lowercase = true,String from = ''});
String toPascalCase(String s);
List<String> generateRandomStrings(int amount,int length,{alphabet = true,numeric = true,special = true,uppercase = true,lowercase = true,String from = ''});
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);
List<String> splitSubdomainInDomains(String name);
String toIDN(String domain);
String fromIDN(String domain)