GlobalFunction class
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
Static Methods
-
abbreviateNumber(int number)
→ String
-
Convert from 1000 to 1K || 1500 to 1.5K
-
fileSizeReadable(String pathFile, {int round = 2})
→ String
-
Get readable file size
https://github.com/synw/filesize
-
formatD(DateTime date, {FormatD format = FormatD.completed})
→ String
-
Format Hari
-
formatDurationReadable(Duration duration, {String separator = ' ', String textForDays = 'Hari', String textForHours = 'Jam', String textForMinutes = 'Menit', String textForSeconds = 'Detik'})
→ String
-
Get readable Duration
-
formatH(DateTime date)
→ String
-
Format Jam
-
formatHM(DateTime date, {String? separator})
→ String
-
Format : Jam:Menit
-
formatHMS(DateTime date, {String? separator})
→ String
-
Format : Jam:Menit:Detik
-
formatM(DateTime date, {FormatM format = FormatM.completed})
→ String
-
Format Bulan
-
formatMD(DateTime date, {FormatMD format = FormatMD.completed})
→ String
-
Format Bulan Hari
-
formatNumber(int value)
→ String
-
Formatted Number from 200000 to 200,000
-
formatTimeReadable(String time, {TimeFormat? timeFormat})
→ String
-
Convert type
TIME database to String
-
formatY(DateTime date)
→ String
-
Format : Tahun
-
formatYM(DateTime date, {FormatYM format = FormatYM.completed})
→ String
-
Format : Tahun:Bulan
type=?
-
formatYMD(DateTime date, {FormatYMD format = FormatYMD.number})
→ String
-
Format : Tahun:Bulan:Hari
type=1/2/3
-
formatYMDH(DateTime date, {FormatYMD formatYmd = FormatYMD.completed})
→ String
-
-
formatYMDHM(DateTime date, {FormatYMD formatYmd = FormatYMD.completed, String? timeSeparator})
→ String
-
-
formatYMDHMS(DateTime date, {FormatYMD formatYmd = FormatYMD.completed, String? timeSeparator})
→ String
-
-
formatYMDSpecific(DateTime date, {FormatYMDSpecific format = FormatYMDSpecific.completed})
→ String
-
Format : Tahun:Bulan:Hari
type=?
Specific disini maksudnya Hari = Senin,Selasa,Rabu,Kamis,Jumat,Sabtu,Minggu
-
fromJsonIntegerToBoolean(int value)
→ bool
-
JSON Converter
Convert from integer to boolean
-
fromJsonMapObjectToMap(Map map)
→ Map<String, dynamic>
-
-
fromJsonMilisecondToDateTime(int? value)
→ DateTime?
-
Mengubah hasil dari json dari
Integer? => DateTime
@param => Integer?
@return => DateTime?
-
fromJsonStringToInteger(dynamic value)
→ int?
-
Mengubah hasil dari json ke
String => Integer
@param => String
@return => Integer?
-
generateRandomString(int length, {GenerateRandomStringRules rules = GenerateRandomStringRules.combineNumberAlphabet, int minLength = 5})
→ String
-
Generate random string take
length parameter to determine number of letter
Rules Available :
GenerateRandomStringRules.onlyNumber => 0123456789
GenerateRandomStringRules.onlyAlphabet => ABCDEFGHIJabcdefghij
GenerateRandomStringRules.onlyAlphabetLowercase => abcdefghij
GenerateRandomStringRules.onlyAlphabetUppercase => ABCDEFGHIJ
GenerateRandomStringRules.combineNumberAlphabet => ABCDE12345abcde
GenerateRandomStringRules.combineNumberAlphabetLowercase => 12345abcde
GenerateRandomStringRules.combineNumberAlphabetUppercase => 12345ABCDE
-
getFirstCharacterEveryWord(String string, {int limitTo = 5})
→ String
-
Get First Character From Every Word
-
getStringBetweenCharacter(String word, {String startSeparator = "(", String endSeparator = ")"})
→ List<String>?
-
String = Zeffry Reynando (Ganteng Sekali), it's 100% (valid)
-
getTotalLenghtWord(String string, {String separator = ' ', int? substract})
→ int
-
Get total length word
-
initializeDateFormatting()
→ Future<void>
-
-
isValueExistObject<T>(List<T> checkedList, T newValue, {required bool check(T element)})
→ T?
-
Check if value in list already exist/not
-
isWeekend(DateTime date)
→ bool
-
return true if today is weekend
-
listOfMonth()
→ Map<int, String>
-
-
listOfYear({required int from, required int to})
→ Map<int, int>
-
-
randomColor(List<Color> colors)
→ Color
-
Mendapatkan warna acak dari kumpulan warna yang sudah ditentukan
-
randomNumber({int min = 0, int max = 100})
→ int
-
randomNumber(10 ,100)
will output : 10,55,95,99 ..etc..
-
range({required int min, required int max})
→ Iterable<int>
-
Get range of number based on the range you specify
-
showDateTimePicker(BuildContext context, {bool withTimePicker = true})
→ Future<DateTime?>
-
Show
Date and Time picker
-
showDetailSingleImage(BuildContext context, {required String url, ImageViewType imageViewType = ImageViewType.network})
→ Future
-
Show
ModalBottomSheet and display detail iamge you defined
Page Detail Single Image will FullScreen
-
showDialogLoading(BuildContext context, {String title = 'Sedang Proses'})
→ Future
-
Show Dialog loading
-
showDialogNeedAccess(BuildContext context, {VoidCallback? onPressed})
→ void
-
Memunculkan dialog untuk membutuhkan akses
-
showSnackBar(BuildContext context, {required Widget content, bool hideWithAnimation = true, SnackBarAction? action, Animation<double>? animation, Color? backgroundColor, SnackBarBehavior? behaviour, Duration duration = const Duration(seconds: 4), double? elevation, EdgeInsetsGeometry? margin, EdgeInsetsGeometry? padding, ShapeBorder? shape, double? width, SnackBarType snackBarType = SnackBarType.normal, SnackBarShape snackBarShape = SnackBarShape.normal})
→ void
-
Memunculkan snackbar
-
stringWithSeparator(String string, {int separateEvery = 4, String separator = '-'})
→ String
-
Separate string with separator you specify
-
toJsonIntegerFromBoolean(bool value)
→ int
-
Convert from boolean to integer
-
toJsonMilisecondFromDateTime(DateTime? date)
→ int?
-
Mengubah hasil ke json dari
DateTime? => Integer
@param => DateTime?
@return => Integer?
-
toJsonStringFromInteger(int? value)
→ String?
-
Mengubah hasil ke json dari
Integer? => String
@param => Integer?
@return => String?
-
toJsonStringFromMap(Map<String, dynamic> map)
→ String
-
-
totalDayInRangeYear({required int fromYear, int? toYear})
→ int
-
Get total day depend of
from & to year defined
-
totalDayInYear(int year)
→ int
-
Get total day of year
-
totalDaysOfMonth({required int year, required int month})
→ int
-
Get total day of month
-
totalWeekDayOrWeekEnd(int year, {int month = 1, int day = 1, TypeWeek typeWeek = TypeWeek.isWeekday, TypeDateTotal typeDateTotal = TypeDateTotal.month})
→ int
-
Get total
WeekDay or WeekEnd depend of type.
-
unFormatNumber(String number)
→ String
-
Unformatted number from 200,000 to 200000
-
validateIsEmpty(String? value, [String message = 'Input tidak boleh kosong'])
→ String?
-
-
validateIsEqual(String? value1, String? value2, [String message = 'input tidak matching'])
→ String?
-
-
validateIsValidEmail(String? value, [String message = 'Email tidak valid'])
→ String?
-