resolve abstract method
Represents a segment or fragment of a placeholder expression.
A Part
is a building block used during placeholder parsing and resolution.
It may represent literal text or a placeholder that must be resolved using a
`PartResolutionContext`
.
This interface is used by the placeholder parsing engine to build a list of
Part
s which can then be resolved dynamically during runtime.
You typically do not implement this directly unless building a custom placeholder parser or resolver engine.
Example usage
final context = MyPartResolutionContext(); // Your custom implementation
final parts = <Part>[...]; // Populated from parsing
final resolved = Part.resolveAll(parts, context);
print(resolved); // Prints the fully resolved placeholder string
Resolves this part using the given resolutionContext
.
The implementation will determine how to transform this part into a final string result. For example, a placeholder part would extract its value from the context, while a literal part would return itself.
Example
part.resolve(context); // -> "resolved value"
Implementation
/// {@template part_resolve}
/// Resolves this part using the given [resolutionContext].
///
/// The implementation will determine how to transform this part into
/// a final string result. For example, a placeholder part would extract
/// its value from the context, while a literal part would return itself.
///
/// ### Example
/// ```dart
/// part.resolve(context); // -> "resolved value"
/// ```
/// {@endtemplate}
String resolve(PlaceholderPartResolutionContext resolutionContext);