StringUtils class
A utility class for working with strings and common string operations.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
add0x(
String value) → String - add the '0x' prefix to a hexadecimal string if it exists.
-
decode(
List< int> value, {StringEncoding type = StringEncoding.utf8, bool allowInvalidOrMalformed = false, bool b64NoPadding = false, Base58Alphabets base58alphabets = Base58Alphabets.bitcoin}) → String -
Decodes a list of bytes
value
into a string using the specifiedtype
. -
decodeJson<
T extends Object> (List< int> value, {Object? reviver(Object?, Object?)?}) → T -
Decodes a list of bytes
value
into a JSON object of typeT
. -
encode(
String value, {StringEncoding type = StringEncoding.utf8, bool validateB64Padding = true, bool allowUrlSafe = true, Base58Alphabets base58alphabets = Base58Alphabets.bitcoin}) → List< int> -
Encodes the given
value
string into a list of bytes using the specifiedtype
. -
encodeJson(
Object json, {String? indent, bool toStringEncodable = false, Object? toEncodable(dynamic)?}) → List< int> -
Encodes a JSON-serializable
json
object into a list of bytes. -
fromJson(
Object data, {String? indent, bool toStringEncodable = false, Object? toEncodable(dynamic)?}) → String - Converts a Dart object represented as a Map to a JSON-encoded string.
-
hexEqual(
String a, String b) → bool -
isBase58(
String input) → bool -
isBase64(
String input, {bool validatePadding = true}) → bool -
isHexBytes(
String v) → bool -
ixHexaDecimalNumber(
String v) → bool -
normalizeHex(
String hexString) → String -
strip0x(
String value) → String - Removes the '0x' prefix from a hexadecimal string if it exists.
-
toBytes(
String v) → List< int> -
toJson<
T extends Object?> (Object? data, {Object? reviver(Object?, Object?)?}) → T - Converts a JSON-encoded string to a Dart object represented as a Map.
-
tryDecode(
List< int> ? value, {StringEncoding type = StringEncoding.utf8, bool allowInvalidOrMalformed = false, bool b64NoPadding = false, Base58Alphabets base58alphabets = Base58Alphabets.bitcoin}) → String? -
Decodes a list of bytes
value
into a string using the specifiedtype
if possible. -
tryDecodeJson<
T extends Object> (List< int> value, {Object? reviver(Object?, Object?)?}) → T? -
Attempts to decode a list of bytes
value
into a JSON object of typeT
, returningnull
if decoding or parsing fails. -
tryEncode(
String? value, {StringEncoding type = StringEncoding.utf8, bool validateB64Padding = true, bool allowUrlSafe = true, Base58Alphabets base58alphabets = Base58Alphabets.bitcoin}) → List< int> ? -
Encodes the given
value
string into a list of bytes using the specifiedtype
if possible. -
tryEncodeJson(
Object? json, {String? indent, bool toStringEncodable = false, Object? toEncodable(dynamic)?}) → List< int> ? -
Attempts to encode a JSON-serializable
json
object into a list of bytes, returning null if the conversion to JSON string fails. -
tryFromJson(
Object? data, {String? indent, bool toStringEncodable = false, Object? toEncodable(dynamic)?}) → String? - Converts a Dart object represented as a Map to a JSON-encoded string if possible.
-
tryToBytes(
String? v) → List< int> ? -
tryToJson<
T extends Object?> (Object? data, {Object? reviver(Object?, Object?)?}) → T? - Converts a JSON-encoded string to a Dart object represented as a Map if possible.