Context class
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
)
}
}
Constructors
-
Context({List<
String> prefixes = const [], bool prod = false, List<String> suffixes = const [], String packId = '', String file = '', String? loadFile = 'load', String? mainFile = 'main', double version = 20.4, Path path = const Path([]), Map<String, String?> ? macros, Map<Type, dynamic> ? traits}) - 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:
- Context.clone(Context context)
Properties
- file ↔ String
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- loadFile ↔ String?
-
getter/setter pair
-
macros
→ Map<
String, String?> -
final
- mainFile ↔ String?
-
getter/setter pair
- packId ↔ String
-
getter/setter pair
- path ↔ Path
-
getter/setter pair
-
prefixes
↔ List<
String> -
getter/setter pair
- prod ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
suffixes
↔ List<
String> -
getter/setter pair
- version ↔ double
-
getter/setter pair
Methods
-
addPath(
Path p) → Context -
addPrefix(
String? prev) → Context -
addSuffix(
String? suf) → Context -
argument<
T> (String name) → T -
buildArgument<
T> (String name, (T, String?) builder(double), {bool replaceDouble = false}) → T -
doubleArgument(
String name) → double -
entityArgument(
String name) → Entity -
intArgument(
String name) → int -
locationArgument(
String name) → Location -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
passTrait<
T> (T t) → void -
scoreArgument(
String name) → Score -
stringArgument(
String name) → String -
toString(
) → String -
A string representation of this object.
inherited
-
traitOf<
T> () → T
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited