PrintFunctionCallback typedef
Callback type definition for a function that prints logs with optional error indication.
This typedef defines a function signature for logging purposes, where:
prefix
is a string indicating the prefix of the log message.value
is the dynamic value to be logged.info
provides additional information to be included in the log message.isError
is an optional boolean parameter indicating if the log represents an error.
Example:
PrintFunctionCallback myLogger = (prefix, value, info, {isError}) {
printFunction(prefix, value, info, isError: isError ?? false);
};
myLogger('ERROR:', 'An error occurred', 'Something went wrong', isError: true);
This typedef can be used to define functions that conform to this signature, providing flexibility in handling logging operations within Dart applications.
Implementation
typedef PrintFunctionCallback = void Function(
String prefix,
dynamic value,
String info, {
bool? isError,
});