Mixins class

Constructors

Mixins()

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

base64ToFile(String base64) Future<File>
File file = await Mixins.base64ToFile('BASE64-STRING');
base64ToImage(String base64) Future<Image>
Image image = await Mixins.base64ToImage('BASE64-STRING');
copy(String text) Future<bool>
Mixins.copy('YOUR TEXT');
errorCatcher(dynamic e, StackTrace s) → dynamic
catch (e, s){ Mixins.errorCatcher(e, s); }
fileToBase64(File file) Future<String>
String base64 = await Mixins.fileToBase64(file);
hex(String code) Color
Mixins.hex('fff'); // white
imageToFile(String imageName) Future<File>
File file = await 'images/avatar.png'.imageToFile(); // from assets
msToDateTime(int ms, {String format = 'dd/MM/yyyy'}) String
Mixins.msToDateTime(1625386377499, format: 'D, d F Y h:i:s'); // Sabtu, 20 Maret 2021
orientation([List<DeviceOrientation> orientations = const [DeviceOrientation.portraitUp]]) → void
Mixins.orientation([DeviceOrientation.landscapeLeft]);
randNum([int length = 10]) int
Mixins.randNum(18); // generate random int value, max length is 18
randString(int length, {bool withSymbol = false, List<String> customChar = const []}) String
Mixins.randString(10); // generate random string value
scrollHasMax(ScrollController scrollController, dynamic max) bool
This function will set scroll to default position when user scroll to max position
scrollTo(ScrollController scrollController, {int duration = 300, int delay = 50, AxisDirection to = AxisDirection.up}) → dynamic
ScrollController scroll = ScrollController(); Mixins.scrollTo(scroll);
scrollToWidget(GlobalKey<State<StatefulWidget>> key, ScrollController controller, double screenWidth) → void
ListView( controller: yourScrollController, children: [ YourWidget( key: yourGlobalKey ) ] ) onTap: (){ Mixins.scrollToWidget(yourGlobalKey, yourScrollController, MediaQuery.of(context).size.width); }
setCursorToLastPosition(TextEditingController controller, [int time = 0]) → dynamic
TextEditingController name = TextEditingController(); Mixins.setCursorToLastPosition(name);
setSystemUI({Brightness brightness = Brightness.dark, Color? statusBarColor, Color? navDividerColor, Color? navBarColor}) → dynamic
Mixins.setSystemUI();
statusBar([bool show = true]) → void
Mixins.statusBar(true); // set false to hide
timeElapsed(dynamic dateTime, {String? inDay, String? inHour, String? inMinute, String justNow = 'just now'}) String
String timeElapsed = Mixins.timeElapsed('2021-02-24 11:12:30', inDay: 'day ago'); // put value with String or DateTime only // only for 1 month calculation
timer(void then(), [int ms = 50]) Timer
Timer timer = Mixins.timer((){ // do something... }, 100);
urlToFile(String imageUrl, {String format = 'png'}) Future<File>
File file = await Mixins.urlToFile('FILE-URL');