NinjaUiNullStringExtension extension

Extension methods for handling nullable String objects.

on

Properties

initials String

Available on String?, provided by the NinjaUiNullStringExtension extension

Extracts the initials from the String.
no setter
isNotNullAndNotEmpty bool

Available on String?, provided by the NinjaUiNullStringExtension extension

Checks if the nullable String is neither null nor empty.
no setter
toDateTime DateTime?

Available on String?, provided by the NinjaUiNullStringExtension extension

Converts the String to a DateTime object.
no setter
withComma String

Available on String?, provided by the NinjaUiNullStringExtension extension

Adds a comma to the end of the String.
no setter

Methods

formatAsDate({String format = 'dd MMM, yyyy', String placeholder = ''}) String

Available on String?, provided by the NinjaUiNullStringExtension extension

Formats the nullable String as a date string using the specified format.
parseDate(String dateFormat) DateTime?

Available on String?, provided by the NinjaUiNullStringExtension extension

An extension on String? to parse a string into a DateTime? using a custom date format.
replaceIfEmptyOrNull(String placeholder) String

Available on String?, provided by the NinjaUiNullStringExtension extension

Replaces the String with a placeholder if it is null or empty.
toColor({Color placeholder = Colors.white}) Color

Available on String?, provided by the NinjaUiNullStringExtension extension

Converts the current string representation of a color to a Color object.
toSeparatedList({String delimiter = ','}) List<String>

Available on String?, provided by the NinjaUiNullStringExtension extension

Converts the nullable String to a list of strings split by delimiter (Default ,).
toText({String? placeholder, TextStyle? style, TextOverflow? overflow, int? maxLines, TextAlign? textAlign, Locale? locale, Color? selectionColor, String? semanticsLabel, bool? softWrap, StrutStyle? strutStyle, TextDirection? textDirection, TextHeightBehavior? textHeightBehavior, double? textScaleFactor, TextWidthBasis? textWidthBasis, TextScaler? textScaler, double topMargin = 0.0, double bottomMargin = 0.0, double leftMargin = 0.0, double rightMargin = 0.0, bool marginIfNull = false, bool showPlaceholderIfEmpty = false, bool ipsumInDebug = false}) Widget

Available on String?, provided by the NinjaUiNullStringExtension extension

Converts the String to a Text widget.
validString({String defaultValue = '', bool nonEmptyInDebug = false}) String

Available on String?, provided by the NinjaUiNullStringExtension extension

Returns a non-null, trimmed version of the string.
withLineBreak() String

Available on String?, provided by the NinjaUiNullStringExtension extension

Adds a line break to the end of the String.
withPrefix({required String prefix, String placeholder = ''}) String

Available on String?, provided by the NinjaUiNullStringExtension extension

Adds a prefix to the start of the String.
withSuffix({required String suffix, String placeholder = ''}) String

Available on String?, provided by the NinjaUiNullStringExtension extension

Adds a suffix to the end of the String.