Context constructor
Context({})
Maybe you already wondered what this context argument here is The Context is a way to get certain important information from the parents. You can use this context to build more modular Widgets and don't need to hardcode certain files and the pack id:
class LoadWidget extends Widget {
@override
Widget generate(Context context){
return Command('function ' + context.packId + ':' + context.loadFile)
}
}
Implementation
Context({
this.prefixes = const [],
this.prod = false,
this.suffixes = const [],
this.packId = '',
this.file = '',
this.loadFile = 'load',
this.mainFile = 'main',
this.version = 20.4,
this.path = const Path([]),
Map<String, String?>? macros,
Map<Type, dynamic>? traits,
}) : _heredityTraits = traits ?? {},
macros = macros ?? {};