tryParse static method

PhotoSource tryParse(
  1. String? val
)

Implementation

static PhotoSource tryParse(String? val) {
  switch (val) {
    case 'asset':
      return PhotoSource.asset;
    case 'file':
      return PhotoSource.file;
    case 'memory':
      return PhotoSource.memory;
    case 'network':
      return PhotoSource.network;
    case '':
      return PhotoSource.unknown;
    default:
      // print('$val is not a valid ImageSource');
      return PhotoSource.unknown;
  }
}