{"action":"created","issue":{"url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/14","repository_url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing","labels_url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/14/comments","events_url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/14/events","html_url":"https://github.com/VolodymyrLykhonis/flutter_billing/issues/14","id":365269086,"node_id":"MDU6SXNzdWUzNjUyNjkwODY=","number":14,"title":"Exception when calling getProducts","user":{"login":"NotThatBowser","id":22273800,"node_id":"MDQ6VXNlcjIyMjczODAw","avatar_url":"https://avatars2.githubusercontent.com/u/22273800?v=4","gravatar_id":"","url":"https://api.github.com/users/NotThatBowser","html_url":"https://github.com/NotThatBowser","followers_url":"https://api.github.com/users/NotThatBowser/followers","following_url":"https://api.github.com/users/NotThatBowser/following{/other_user}","gists_url":"https://api.github.com/users/NotThatBowser/gists{/gist_id}","starred_url":"https://api.github.com/users/NotThatBowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NotThatBowser/subscriptions","organizations_url":"https://api.github.com/users/NotThatBowser/orgs","repos_url":"https://api.github.com/users/NotThatBowser/repos","events_url":"https://api.github.com/users/NotThatBowser/events{/privacy}","received_events_url":"https://api.github.com/users/NotThatBowser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-30T22:43:21Z","updated_at":"2018-10-09T09:10:27Z","closed_at":null,"author_association":"NONE","body":"When calling getProducts there is an exception:\r\n\r\n`type 'String' is not a subtype of type 'BillingProductType'`\r\n\r\nThis looks like it makes sense as it's reading a json string but expecting an enum (flutter_billing.dart, line 121)."},"comment":{"url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/comments/428118927","html_url":"https://github.com/VolodymyrLykhonis/flutter_billing/issues/14#issuecomment-428118927","issue_url":"https://api.github.com/repos/VolodymyrLykhonis/flutter_billing/issues/14","id":428118927,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODExODkyNw==","user":{"login":"NotThatBowser","id":22273800,"node_id":"MDQ6VXNlcjIyMjczODAw","avatar_url":"https://avatars2.githubusercontent.com/u/22273800?v=4","gravatar_id":"","url":"https://api.github.com/users/NotThatBowser","html_url":"https://github.com/NotThatBowser","followers_url":"https://api.github.com/users/NotThatBowser/followers","following_url":"https://api.github.com/users/NotThatBowser/following{/other_user}","gists_url":"https://api.github.com/users/NotThatBowser/gists{/gist_id}","starred_url":"https://api.github.com/users/NotThatBowser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NotThatBowser/subscriptions","organizations_url":"https://api.github.com/users/NotThatBowser/orgs","repos_url":"https://api.github.com/users/NotThatBowser/repos","events_url":"https://api.github.com/users/NotThatBowser/events{/privacy}","received_events_url":"https://api.github.com/users/NotThatBowser/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T09:10:27Z","updated_at":"2018-10-09T09:10:27Z","author_association":"NONE","body":"Yeah.  Version is 0.2.5 (latest) and using Android platform.\r\n\r\nFor now I've changed my local copy so line 121 always assigns 'BillingProductType.INAPP' since I'm not using subscriptions.  The same issue occurs on line 158 too.\r\n\r\nIt looks like it's taking in a string from the 'product' json response and assigning it to BillingProduct's 'type' field ( 'BillingProductType' enum) without conversion.  The compiler isn't complaining because .fromIterable treats the input as dynamic so it doesn't know 'product' is a list of strings.\r\n\r\nI'm not sure the best way to convert String to enum in dart, but this seems to work:\r\n`BillingProductType.values.firstWhere((e) => e.toString == product['type'])`"}}
{"actor":{"display_login":"NotThatBowser"}}