What are function typedefs / function-type aliases in Dart?

A common usage pattern of typedef in Dart is defining a callback interface. For example: typedef void LoggerOutputFunction(String msg); class Logger { LoggerOutputFunction out; Logger() { out = print; } void log(String msg) { out(msg); } } void timestampLoggerOutputFunction(String msg) { String timeStamp = new Date.now().toString(); print(‘${timeStamp}: $msg’); } void main() { Logger l = … Read more

tech