I'm working on a CLI tool that will generate some text files with style, much like generating HTML. When translating some fields using slang, I also hope to specify some sort of style on this field. It's very similar to how the rich modifier works in slang.
However, as the rich modifier relies on TextSpan, which is not available in pure Dart, I'm stuck here.
What I hope for is something like this, a class similar to TextSpan:
class CustomStyledSpan {
CustomStyledSpan({this.text, this.style, this.children});
final String? text;
final Object? style;
final List<CustomStyledSpan>? children;
}
Motivation
I'm working on a CLI tool that will generate some text files with style, much like generating HTML. When translating some fields using slang, I also hope to specify some sort of style on this field. It's very similar to how the rich modifier works in slang.
However, as the rich modifier relies on TextSpan, which is not available in pure Dart, I'm stuck here.
What I hope for is something like this, a class similar to TextSpan:
and the builder can generate something like this:
Developer Experience
I think this feature would add more flexibility when using slang with pure Dart.
I'm looking into how to implement this feature myself and would really appreciate any guidance or advice anyone can provide.