Style constructor

Style([
  1. Attribute? p1,
  2. Attribute? p2,
  3. Attribute? p3,
  4. Attribute? p4,
  5. Attribute? p5,
  6. Attribute? p6,
  7. Attribute? p7,
  8. Attribute? p8,
  9. Attribute? p9,
  10. Attribute? p10,
  11. Attribute? p11,
  12. Attribute? p12,
  13. Attribute? p13,
  14. Attribute? p14,
  15. Attribute? p15,
  16. Attribute? p16,
  17. Attribute? p17,
  18. Attribute? p18,
  19. Attribute? p19,
  20. Attribute? p20,
])

Creates a new Style instance with a specified list of Attributes.

This factory constructor initializes a Style with a list of attributes provided as individual parameters. Only non-null attributes are included in the resulting Style.

There is no specific reason for only 20 parameters. This is just a reasonable number of parameters to support. If you need more than 20, consider breaking up your mixes into many style mixes that can be applied or use the Style.create constructor.

Example:

final style = Style(attribute1, attribute2, attribute3);

Implementation

factory Style([
  Attribute? p1,
  Attribute? p2,
  Attribute? p3,
  Attribute? p4,
  Attribute? p5,
  Attribute? p6,
  Attribute? p7,
  Attribute? p8,
  Attribute? p9,
  Attribute? p10,
  Attribute? p11,
  Attribute? p12,
  Attribute? p13,
  Attribute? p14,
  Attribute? p15,
  Attribute? p16,
  Attribute? p17,
  Attribute? p18,
  Attribute? p19,
  Attribute? p20,
]) {
  final params = [
    p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, //
    p11, p12, p13, p14, p15, p16, p17, p18, p19, p20,
  ].whereType<Attribute>();

  return Style.create(params);
}