alignFromJson static method

Alignment? alignFromJson(
  1. Map<String, dynamic> json,
  2. String key
)

Implementation

static Alignment? alignFromJson(
    final Map<String, dynamic> json, final String key) {
  if (json[key] == 'bC') return Alignment.bottomCenter;
  if (json[key] == 'bL') return Alignment.bottomLeft;
  if (json[key] == 'bR') return Alignment.bottomRight;
  if (json[key] == 'c') return Alignment.center;
  if (json[key] == 'cL') return Alignment.centerLeft;
  if (json[key] == 'cR') return Alignment.centerRight;
  if (json[key] == 'tC') return Alignment.topCenter;
  if (json[key] == 'tL') return Alignment.topLeft;
  if (json[key] == 'tR') return Alignment.topRight;
  try {
    return Alignment(json[key][0], json[key][1]);
  } catch (_) {}
  return null;
}