Parts.fromText constructor

Parts.fromText(
  1. String text, {
  2. Iterable<Part> parts = const [],
})

Creates a collection of parts from text and optional other parts.

If text is not empty, converts it to a TextPart and puts it as a first member of the parts list.

Implementation

factory Parts.fromText(String text, {Iterable<Part> parts = const []}) =>
    text.isEmpty ? Parts(parts.toList()) : Parts([TextPart(text), ...parts]);