dvStudioAlignOf function

DVAlign dvStudioAlignOf(
  1. Object? name
)

DVAlign by name, defaulting to start.

A name that is not an alignment falls back rather than throwing. Documents are data: they are edited by hand and they arrive from imports, and a page that will not render because one word is misspelled is worse than a page laid out to the start.

Implementation

DVAlign dvStudioAlignOf(Object? name) => switch (name) {
      'center' => DVAlign.center,
      'end' => DVAlign.end,
      'spaceBetween' => DVAlign.spaceBetween,
      'spaceAround' => DVAlign.spaceAround,
      'spaceEvenly' => DVAlign.spaceEvenly,
      _ => DVAlign.start,
    };