Last updated:
0 purchases
sam utils
sam_utils #
A Flutter library for commonly used utility functions.
Supported platforms #
Android
iOS
Web
macOS
linux
windows
Getting Started #
To use this package, add sam_utils as a dependency in your pubspec.yaml file.
Usage #
Import the library using:
import 'package:sam_utils/sam_utils.dart';
copied to clipboard
Documentation #
Prints log messages to the console with an optional tag.
printLog(String strLogMessage, [String? strTag]);
copied to clipboard
Returns true if the app is running on a web platform, false otherwise.
bool isAppRunningOnWeb = isAppRunningOnWeb();
copied to clipboard
Returns true if the provided email is in a valid format, false otherwise.
bool isEmailValid = isEmailValid(String ? email);
copied to clipboard
Returns the trimmed text of the provided TextEditingController as a String.
String text = getTextEditingString(TextEditingController ? controller);
copied to clipboard
Returns true if the TextEditingController is null or its text is empty, false otherwise.
bool isTextEditingEmpty = isTextEditingEmpty(TextEditingController ? controller);
copied to clipboard
Returns the width of the screen in pixels.
double screenWidth = getScreenWidth(BuildContext ? buildContext);
copied to clipboard
Converts the provided dynamic value to double.
double val = parseDynamicToDouble(dynamic value);
copied to clipboard
Returns the name of the platform the app is running on.
String platformName = getPlatformName();
copied to clipboard
Returns the current date and time in the format 'dd-MM-yyyy HH:mm:ss'
String currentDateTime = SamUtils().getCurrentDateTime();
copied to clipboard
Returns the current date in the format 'dd-MM-yyyy'
String currentDate = SamUtils().getCurrentDate();
copied to clipboard
Returns the current time in the format 'HH:mm:ss'
String currentTime = SamUtils().getCurrentTime();
copied to clipboard
Returns the current timestamp in milliseconds
String currentTimeStamp = SamUtils().getCurrentTimeStamp();
copied to clipboard
Returns the number of hours in the provided number of milliseconds.
int hours = SamUtils().millisecondToHours(int milliseconds);
copied to clipboard
Contributions #
Feel free to contribute by creating pull requests.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.