StringUtils class

A utility class for working with strings and common string operations.

Constructors

StringUtils.new()

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 specified type.
decodeJson<T extends Object>(List<int> value, {Object? reviver(Object?, Object?)?}) → T
Decodes a list of bytes value into a JSON object of type T.
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 specified type.
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 specified type 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 type T, returning null 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 specified type 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.