Attribute constructor

const Attribute({
  1. required String name,
  2. String? type,
  3. String? init,
  4. String? html,
  5. bool isBool = false,
})

Implementation

const Attribute({
  required this.name,
  String? type,
  String? init,
  String? html,
  bool isBool = false,
}) : assert(name != ''),
     type = type ?? (isBool ? 'final bool $name;' : 'final String? $name;'),
     init = init ?? (isBool ? 'this.$name = false' : 'this.$name'),
     html =
         html ??
         (isBool
             ? 'if ($name) \' $name\''
             : 'if ($name != null) \' $name="\$$name"\''),
     isBool = isBool;