afya_moja_core/afya_moja_core
library
Functions
-
alignLabelWithHint(int? maxLines)
→ bool
-
-
audioTime(int duration)
→ String
-
Converts a duration in seconds to a formatted audio time representation.
-
boldSize12Text([Color? color])
→ TextStyle
-
-
boldSize13Text([Color? color])
→ TextStyle
-
-
boldSize14Text([Color? color])
→ TextStyle
-
-
boldSize15Text([Color? color])
→ TextStyle
-
-
boldSize16Text([Color? color])
→ TextStyle
-
-
boldSize18Text([Color? color])
→ TextStyle
-
-
boldSize20Text([Color? color])
→ TextStyle
-
-
boldSize22Text([Color? color])
→ TextStyle
-
-
boldSize24Text([Color? color])
→ TextStyle
-
-
boldSize26Title([Color? color])
→ TextStyle
-
-
boldSize30Text([Color? color])
→ TextStyle
-
-
boldSize45Text([Color? color])
→ TextStyle
-
-
cccNumberValidator(dynamic val)
→ String?
-
Validates a user-entered CCC number.
-
consentStatusFromJson(String? consentString)
→ ConsentStatus
-
Converts a consent status string to a ConsentStatus enumeration value.
-
consentStatusToJson(ConsentStatus? consentStatus)
→ String
-
Converts a ConsentStatus enumeration value to a consent status string for JSON serialization.
-
contactTypeFromJson(String? contactString)
→ ContactType
-
Converts a contact type string to a ContactType enumeration value.
-
contentAudioVideoDuration(int duration)
→ String
-
-
contentReadDuration(int duration)
→ String
-
-
customRoundedPinBoxDecoration(Color borderColor, Color pinBoxColor, {double borderWidth = 1.0, double? radius, bool showShadow = false})
→ BoxDecoration
-
-
dayOfWeekFromJson(String? dayOfWeek)
→ DayOfWeek
-
-
dismissSnackBar(String text, Color color, BuildContext context)
→ SnackBarAction
-
Dismiss snackbar
-
Extracts an error code from a JSON response body.
-
extractNamesInitials => Extracts name initials from a name
-
formatDate(String date, {bool showTime = false})
→ String
-
Formats a given date/time string into a user-friendly date representation.
-
formatPhoneNumber({required String countryCode, required String phoneNumber})
→ String
-
Formats a phone number by adding the country code and applying specific rules.
-
genderFromJson(String? genderString)
→ Gender
-
Converts a JSON gender string to a corresponding Gender enumeration.
-
genderToJson(Gender? gender)
→ String
-
Converts a Gender enumeration to a JSON string representation.
-
genericFetchFunction({required StreamController streamController, required BuildContext context, required String queryString, required Map<String, dynamic> variables, required String logTitle, String? logDescription})
→ Future<void>
-
Generic Fetch Function
a generic fetch function for fetching all the problems, allergies
medications, tests and diagnoses for the current patient
in an episode
-
getDeviceType(BuildContext context)
→ DeviceScreensType
-
getDeviceType
/// Determines the type of device screen based on its width and orientation.
-
getErrorMessage([String message = ''])
→ String
-
Retrieves an error message based on an optional custom message.
-
getGreetingMessage(String? firstName, {int? currentHour})
→ String
-
getGreetingMessage gets the current time of day and determines which type of greetings to show
to the user
-
getSentryEnvironment(AppConfig appConfig)
→ String
-
-
getTokenExpiryTimestamp(String? expiresIn)
→ DateTime
-
expiresIn is in seconds
-
getUserFriendlyMsg(int code)
→ String
-
Retrieves a user-friendly error message based on an error code.
-
hasTokenExpired(DateTime expiresAt, DateTime now)
→ bool
-
Checks if token has expired based on expiry date
returns true if token expires in 10 minutes or less
otherwise returns false
-
headsUpNotification(String? title, String? body)
→ OverlaySupportEntry
-
Displays a heads-up notification overlay.
-
heavySize10Text([Color? color])
→ TextStyle
-
-
heavySize11Text([Color? color])
→ TextStyle
-
-
heavySize12Text([Color? color])
→ TextStyle
-
-
heavySize13Text([Color? color])
→ TextStyle
-
-
heavySize14Text([Color? color])
→ TextStyle
-
-
heavySize16Text([Color? color])
→ TextStyle
-
-
heavySize18Text([Color? color])
→ TextStyle
-
-
heavySize20Text([Color? color])
→ TextStyle
-
-
heavySize24Text([Color? color])
→ TextStyle
-
-
heavySize26Text([Color? color])
→ TextStyle
-
-
heavySize28Text([Color? color])
→ TextStyle
-
-
heavySize50Text([Color? color])
→ TextStyle
-
-
humanizeDate({required TextStyle dateTextStyle, required String loadedDate, bool showTime = false, bool showYear = true})
→ Widget
-
-
isNumeric(String? s)
→ bool
-
-
isValidPhoneNumber(String phone)
→ bool
-
isValidPhoneNumber checks if a number is either a
Kenyan
, American
, UK
or Belgium
phone number
-
lightSize16Text([Color? color])
→ TextStyle
-
-
mapDayOfWeek(int weekday)
→ DayOfWeek
-
-
mediumSize14Text([Color? color])
→ TextStyle
-
-
mediumSize20Text([Color? color])
→ TextStyle
-
-
mediumSize22Text([Color? color])
→ TextStyle
-
-
mediumSize24Text([Color? color])
→ TextStyle
-
-
newChatMessageTitle(String? username, String? channelName)
→ String
-
Generates a title for a new chat message notification.
-
normalSize10Text([Color? color])
→ TextStyle
-
-
normalSize11Text([Color? color])
→ TextStyle
-
-
normalSize12Text([Color? color])
→ TextStyle
-
-
normalSize13Text([Color? color])
→ TextStyle
-
-
normalSize14Text([Color? color])
→ TextStyle
-
-
normalSize15Text([Color? color])
→ TextStyle
-
-
normalSize16Text([Color? color])
→ TextStyle
-
-
normalSize17Text([Color? color])
→ TextStyle
-
-
normalSize18Text([Color? color])
→ TextStyle
-
-
normalSize20Text([Color? color])
→ TextStyle
-
-
normalSize22Text([Color? color])
→ TextStyle
-
-
normalSize24Text([Color? color])
→ TextStyle
-
-
normalSize26Text([Color? color])
→ TextStyle
-
-
normalSize28Text([Color? color])
→ TextStyle
-
-
normalSize32Text([Color? color])
→ TextStyle
-
-
normalSize34Text([Color? color])
→ TextStyle
-
-
normalSize9Text([Color? color])
→ TextStyle
-
-
parseError(Map<String, dynamic>? body)
→ String?
-
Parses an error message from a JSON response body.
-
processHttpResponse(Response response)
→ ProcessedResponse
-
Processes an HTTP response and returns a ProcessedResponse object.
-
removeUnderscores(String sentence)
→ String
-
removeUnderscores removes underscores from a sentence
-
roleValueFromJson(String? roleString)
→ RoleValue
-
Converts a JSON role string to a corresponding RoleValue enumeration.
-
snackbar({required dynamic content, int durationSeconds = 10, String? label, Function? callback})
→ SnackBar
-
snackbar
-
summarizeDate(String loadedDate)
→ String
-
Summarizes a given date/time string into a human-readable format.
-
titleCase(String sentence)
→ String
-
titleCase returns a title cased sentence
-
userPinValidator(dynamic val)
→ String?
-
This function performs validation on a user-entered PIN value. It ensures that
the PIN is not empty, consists of only digits, and has a minimum length of four.
The function returns an error message string if the validation fails, otherwise
it returns
null
to indicate a valid PIN.
-
validateKenyanNumber(String phone)
→ bool
-
validateKenyanNumber checks if a number is either has either prefix of '+254111', '+254110', '+254100', '+2540101', '+254102' or '+2547xx'
-
validatePhoneNumber(String input)
→ Either<ValueObjectFailure<String>, String>
-
-
veryBoldSize14Text([Color? color])
→ TextStyle
-
-
veryBoldSize15Text([Color? color])
→ TextStyle
-
-
veryBoldSize16Text([Color? color])
→ TextStyle
-
-
veryBoldSize17Text([Color? color])
→ TextStyle
-
-
veryBoldSize18Text([Color? color])
→ TextStyle
-
-
veryBoldSize20Text([Color? color])
→ TextStyle
-
-
veryBoldSize22Text([Color? color])
→ TextStyle
-
-
veryBoldSize28Text([Color? color])
→ TextStyle
-
-
veryBoldSize32Text([Color? color])
→ TextStyle
-
-
veryHeavySize12Text([Color? color])
→ TextStyle
-
-
veryHeavySize14Text([Color? color])
→ TextStyle
-
-
veryHeavySize20Text([Color? color])
→ TextStyle
-
Exceptions / Errors
-
MyAfyaException
-
A custom exception class for application errors.