GooglePass.fromUrl constructor

GooglePass.fromUrl(
  1. Uri uri
)

Creates a new GooglePass from a google pay url.

Will throw a PlatformWalletException on invalid url, or if the wallet API is not available.

Example:

final Uri uri = Uri.parse("https://pay.google.com/gp/v/save/ey...");
try {
  final GooglePass pass = GooglePass.fromUrl(uri);
  pass.save();
} on PlatformWalletException catch (e) {
  print("Something went wrong...");
  print(e);
}

Implementation

factory GooglePass.fromUrl(Uri uri) {
  final token = _parseToken(uri);
  return GooglePass._(type: GooglePassType.url, token: token);
}