PrintFunctionCallback<T> typedef
Callback type definition for a function that prints logs with optional error indication.
This typedef defines a function signature for logging purposes, where:
prefixis a string indicating the prefix of the log message.valueis the dynamic value to be logged.infoprovides additional information to be included in the log message.isErroris 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<T> = void Function(
String prefix,
T value,
String info, {
bool? isError,
});