From f336f4ecf579f63f4dd4e90182f3461ac3d6f480 Mon Sep 17 00:00:00 2001 From: Markin Igor <markin.io210@gmail.com> Date: Fri, 2 Aug 2019 19:09:27 +0500 Subject: [PATCH] Parse error details for Android. --- lib/src/app.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/app.dart b/lib/src/app.dart index 3839e62..d9ea905 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -114,11 +114,17 @@ class _MainAppState extends State<MainApp> { log("Err $error"); String errorMessage = error.message; - String errorDetails = error.details; + String errorDetails = ""; + + try { + errorDetails = json.decode(error.details)["errorDescription"]; + } catch (e) { + errorDetails = error.details; + } if ( // Handle cancellation for Android - errorDetails == '{"type":0,"code":1,"errorDescription":"User cancelled flow"}' || + errorDetails == 'User cancelled flow' || // Handle cancellation for iOS errorMessage.toLowerCase().contains("the operation couldn") ) { -- GitLab