fromUriOrNull static method

GenerateDartModel? fromUriOrNull(
  1. Uri? uri
)

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

Implementation

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