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

invalid use of incomplete type

The reason is that when instantiating a class template, all its declarations (not the definitions) of its member functions are instantiated too. The class template is instantiated precisely when the full definition of a specialization is required. That is the case when it is used as a base class for example, as in your case. … Read more

Forward-declare enum in Objective-C

Most recent way (Swift 3; May 2017) to forward declare the enum (NS_ENUM/NS_OPTION) in objective-c is to use the following: // Forward declaration for XYZCharacterType in other header say XYZCharacter.h typedef NS_ENUM(NSUInteger, XYZCharacterType); // Enum declaration header: “XYZEnumType.h” #ifndef XYZCharacterType_h #define XYZCharacterType_h typedef NS_ENUM(NSUInteger, XYZEnumType) { XYZCharacterTypeNotSet, XYZCharacterTypeAgent, XYZCharacterTypeKiller, }; #endif /* XYZCharacterType_h */`