fromString static method

TestStatusAlignment fromString(
  1. String? data
)

Converts the alignment from a string to an actual object. This will throw an exception if the string does not match any valid value.

Implementation

static TestStatusAlignment fromString(String? data) {
  TestStatusAlignment? result;

  if (data != null) {
    switch (data) {
      case 'bottom':
        result = TestStatusAlignment.bottom;
        break;
      case 'bottomSafe':
        result = TestStatusAlignment.bottomSafe;
        break;
      case 'center':
        result = TestStatusAlignment.center;
        break;
      case 'top':
        result = TestStatusAlignment.top;
        break;
      case 'topSafe':
        result = TestStatusAlignment.topSafe;
        break;
    }
  }

  if (result == null) {
    throw Exception(
      'No matching TestStatusAlignment exists for value: [$data].',
    );
  }
  return result;
}