StringUtils class

A class containing string utility functions

This class provides utility functions for formatting bytes, JSON strings, converting objects to strings, and other string manipulation operations.

Constructors

StringUtils()

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

convertJsonToString(dynamic map) String
Converts a JSON object to a formatted string
convertObjectToString(dynamic data, {bool isFormatText = true}) String
Converts an object to a formatted string representation
convertStringToJson(String? text) Map<String, dynamic>?
Converts a JSON string to a Map object
convertStringToObject(dynamic text) → dynamic
Converts a string to an object
formatBytes(int bytes, [int decimals = 2]) String
Formats bytes to a human-readable string with appropriate units
formatHeaderContent(String? header, List<String?> contents) String
Formats header content with proper indentation
formatJsonString(String? json) String
Formats a JSON string for better readability
getBaseUrlAndPath(String? url) String
Extracts the base URL and path from a full URL
getErrorContent(String? content, {int maxLines = 3, int maxLength = 150}) String
Gets a formatted error content with line and character limits
getTimeFromMiliseconds(int? milliseconds) String
Converts milliseconds to a human-readable time string