strings_constants 0.0.4
strings_constants: ^0.0.4 copied to clipboard
A Flutter Plugin that provides a collection of string constants.
The Package provides a list of frequently used String constants, duplicating Python's string.py
library
Usage #
To use this plugin, add string_constants
as a dependency in your pubspec.yaml
file.
Example #
String onlyDigits = Strings.digits; // onlyDigits = '0123456789';
String lowerCase = Strings.asciiLowerCase; // lowerCase = 'abcdefghijklmnopqrstuvwxyz';
String upperCase = Strings.asciiUpperCase; // upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// Generates random string from ASCII Characters with defined length
String generateRandomString(int len) {
final r = Random();
const _chars = Strings.asciiCharacters; // _chars now contains all letters and digits;
return List.generate(len, (index) => _chars[r.nextInt(_chars.length)]).join();
}