fromUriOrNull static method

FieldModel? fromUriOrNull(
  1. Uri? uri
)

Constructs a new instance of FieldModel, from the query parameters of uri. Returns null if uri is null or if the conversion fails.

Implementation

static FieldModel? fromUriOrNull(
  Uri? uri,
) {
  try {
    if (uri != null && uri.path == CLASS_NAME) {
      return FieldModel.fromJson(uri.queryParameters);
    } else {
      return FieldModel.assertRequired();
    }
  } catch (_) {
    return null;
  }
}