sam_utils 0.0.6 copy "sam_utils: ^0.0.6" to clipboard
sam_utils: ^0.0.6 copied to clipboard

outdated

short description of the package here that helps potential users know whether this package might be useful for them.

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';

Features #

Prints log messages to the console with an optional tag.

printLog(String strLogMessage, [String? strTag]);

Returns true if the app is running on a web platform, false otherwise.

bool isAppRunningOnWeb = isAppRunningOnWeb();

Returns true if the provided email is in a valid format, false otherwise.


bool isEmailValid = isEmailValid(String ? email);

Returns a Future


bool isNetworkConnected = await SamUtils().isNetworkConnected();

Returns the trimmed text of the provided TextEditingController as a String.


String text = getTextEditingString(TextEditingController ? controller);

Returns true if the TextEditingController is null or its text is empty, false otherwise.


bool isTextEditingEmpty = isTextEditingEmpty(TextEditingController ? controller);

Returns the width of the screen in pixels.


double screenWidth = getScreenWidth(BuildContext ? buildContext);

Converts the provided dynamic value to double.


double val = parseDynamicToDouble(dynamic value);

Returns the name of the platform the app is running on.


String platformName = getPlatformName();

Returns the current date and time in the format 'dd-MM-yyyy HH:mm:ss'


String currentDateTime = SamUtils().getCurrentDateTime();

Returns the current date in the format 'dd-MM-yyyy'


String currentDate = SamUtils().getCurrentDate();

Returns the current time in the format 'HH:mm:ss'


String currentTime = SamUtils().getCurrentTime();

Returns the current timestamp in milliseconds


String currentTimeStamp = SamUtils().getCurrentTimeStamp();

Returns the number of hours in the provided number of milliseconds.


int hours = SamUtils().millisecondToHours(int milliseconds);

Contributions #

Feel free to contribute by creating pull requests.

1
likes
0
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

short description of the package here that helps potential users know whether this package might be useful for them.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

connectivity_plus, flutter, intl

More

Packages that depend on sam_utils