YustHelpers class
Yust helpers
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
-
addDaysOrMore(
DateTime dateTime, {int days = 0, int months = 0, int years = 0}) → DateTime - adds a Duration that is more that 24 hours this works with time shifts like daylight saving time
-
addMonthsWithoutOverflow(
int months, DateTime date) → DateTime -
Adds
monthsto thedatewith no day overflow in the next month. -
clearTime(
DateTime dateTime) → DateTime -
Removes any local time from the given
dateTimeby converting the given utc date time to local, removing the time part and converting back to utc. -
createContentDisposition(
String filename) → String - Creates a proper Content-Disposition header value with UTF-8 encoded filename
-
dateDifference(
DateTime? first, DateTime? second) → Duration - Use this function instead of DateTime.difference!
-
dateTimeIncludeTime(
DateTime dateTime) → bool -
Returns true if the given
dateTimeincludes a time. -
formatDate(
DateTime? dateTime, {String locale = 'de', String? format}) → String -
Return a string representing
dateTimein the German or English date format or another givenformat. -
formatTime(
DateTime? dateTime, {String? format}) → String -
Return a string representing
dateTimein the German time format or another givenformat. -
getDateAtDayOfCurrentMonth(
int day) → DateTime - Returns the DateTime at the day of the current month.
-
getDateAtDayOfMonth(
int day, DateTime month) → DateTime -
Returns the DateTime at the
dayin themonth, with no day overflow. -
getValueByPath(
Map< String, dynamic> object, String path) → dynamic - Get the value of a map by path. The path is a dot-separated path of keys, which may be escaped with backticks.
-
localNow(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool minuteGranularity = false}) → DateTime - Returns the current date and time in the local timezone.
-
localToday(
) → DateTime - Returns the current date in the local timezone.
-
localToUtc(
DateTime dateTime) → DateTime -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
numToString(
num number, {bool thousandsSeparator = false, int wholeDigitCount = 1, int decimalDigitCount = 2, bool padDecimalDigits = false, String locale = 'de-DE', String? unit}) → String -
Formats a number to a string.
The number is rounded to
decimalDigitCountdecimal places and optionally padded with zeros ifpadDecimalDigitsis true. IfthousandsSeparatoris true, the number is formatted with a thousands separator. Uselocaleto specify the thousands separator and decimal separator. The number is padded with zeros to the left to reach at leastwholeDigitCountwhole digits. -
preserveKeysInMap(
Map< String, dynamic> object, List<String> keys) → void - Clean a map, except of some keys.
-
randomString(
{int length = 8, bool includeCapitalLetters = true}) → String - Returns a random String with a specific length.
-
removeKeysFromMap(
Map< String, dynamic> object, List<String> keys) → void - Remove multiple keys from a map.
-
roundToDecimalPlaces(
num value, [int fractionalDigits = 8]) → double - Rounds a number to the given amount of decimal places
-
searchString(
{required List< String> strings, required String searchString, bool ignoreCase = true, bool reorder = true}) → List<int> -
Returns a list of indexes of the found strings.
The search looks for strings that contain the search
searchString. -
stringToNumber(
String text, {int? precision, String locale = 'de-DE'}) → num? -
Parse a string to a number.
If
precisionis null, the number is parsed as is. Ifprecisionis 0, the number is rounded to the nearest integer. Ifprecisionis given, the number is rounded to exactlyprecisiondecimal places. Uselocaleto specify the thousands separator and decimal separator. -
toQuotedFieldPath(
String? fieldPath) → String? - Returns a quoted field path.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryLocalToUtc(
DateTime? dateTime) → DateTime? -
tryUtcToLocal(
DateTime? dateTime) → DateTime? -
utcNow(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) → DateTime - Returns the current date and time in UTC.
-
utcToLocal(
DateTime dateTime) → DateTime
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- mockNowUTC ↔ TZDateTime?
-
Mock the current time in UTC. Only use this in tests!!!
getter/setter pair