service/util library
Functions
-
generateUuid(
) → String - Generates a random UUID (Universally Unique Identifier).
-
getAllFileNamesByExtension(
String extension) → Future< List< String> > - Fetches the names of all files with the specified extension.
-
getFileContentAsString(
String fileName, {String? folder}) → Future< String?> - Reads the content of a user-generated file as a string.
-
getNowDateTimeYyyyMmDdHhMmSs(
) → String -
Returns the current date and time in the format:
yyyyMMddHHmmss. -
getPIHForFirstInvoice(
) → String - Returns the predefined PIH (Public Invoice Hash) string for the first invoice.
-
getStorageFolderPath(
) → Future< String> - Retrieves the base storage folder path for the app.
-
getZatcaCompliantDate(
DateTime date) → String -
Formats a DateTime object into a ZATCA-compliant date string (
yyyy-MM-dd). -
getZatcaCompliantTime(
DateTime time) → String -
Formats a DateTime object into a ZATCA-compliant time string (
HH:mm:ss). -
loadInvoiceRequest(
{required String fileName, bool useAsAbsolutePath = false}) → Future< InvoiceRequest?> - Loads an InvoiceRequest from a JSON file.
-
logError(
String message) → void - Logs an error message in red color in the console.
-
logInfo(
String message) → void - Logs an info message in green color in the console.
-
renameFile(
{required String oldName, required String newName}) → Future< bool> -
Renames a file from
oldNametonewName. -
saveToAbsolutePath(
String content, String path) → Future< void> -
Saves
contentto an absolutepath. -
saveToFile(
String content, String fileName, {String? folder}) → Future< String> -
Saves
contentto a filefileNamein optionalfolder.