template_parser 0.0.2 copy "template_parser: ^0.0.2" to clipboard
template_parser: ^0.0.2 copied to clipboard

A flutter package to parse String template. It's a secure template language that is also very accessible for programmer audiences.

TemplateParser pub package #

A flutter package to parse String template.

Installation #

You just need to add template_parser as a dependency in your pubspec.yaml file.

dependencies:
  template_parser: ^0.0.2

Example #

A simple usage example:

import 'package:template_parser/template_parser.dart';

main() {
   final template = 'My name is {{FullName}}. I am {{ Age }}, have worked as a '
      '{{designation}} for a bigger company, in an agile team, working mostly '
      'on {{Skills}} platform.';

  final List<TemplateModel> models = [
    TemplateModel(variable: 'FullName', value: 'Sodipto Saha'),
    TemplateModel(variable: 'Age', value: '26'),
    TemplateModel(variable: 'designation', value: 'Senior Software Engineer'),
    TemplateModel(variable: 'Skills', value: 'Flutter,C# And .NET Core'),
  ];
  
  final parseTemplate=TemplateParser.parse(template, models);
  print(parseTemplate);
}

TemplateModel #

Name Description Example
variable variable of the template {{FullName}}
value Value of the template variable Sodipto Saha

Warning #

Note: {{}} is required for template rendering.


{{}} ❌
{Variable} ❌
{Variable ❌
{Variable}} ❌
{{Variable} ❌
{{Variable}} ✔️
{{ Variable }} ✔️
{{variable }} ✔️
{{ variable}} ✔️
{{ variable variable }} ✔️

Features and bugs #

Please file feature requests and bugs at the issue tracker.

3
likes
140
pub points
22%
popularity

Publisher

verified publishersodipto.me

A flutter package to parse String template. It's a secure template language that is also very accessible for programmer audiences.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on template_parser