fromJsonString static method

Oauth2Scopes fromJsonString({
  1. required String jsonString,
})

Converts a jsonString to a Oauth2Scopes

Throws a RangeError if the jsonString doesn't correspond to any of the know values.

Implementation

static Oauth2Scopes fromJsonString({
  required String jsonString,
}) {
  switch (jsonString) {
    case "openid":
      return Oauth2Scopes.openid;
    case "email":
      return Oauth2Scopes.email;
    case "profile":
      return Oauth2Scopes.profile;
    case "address":
      return Oauth2Scopes.address;
    case "phone":
      return Oauth2Scopes.phone;
    case "com.intuit.quickbooks.accounting":
      return Oauth2Scopes.accounting;
    case "com.intuit.quickbooks.payment":
      return Oauth2Scopes.payment;

    default:
      throw RangeError("There's no scope corresponding to $jsonString.");
  }
}