Created
August 26, 2024 09:33
-
-
Save bschulz87/cb0681a6082049ee4da18bf88a5742ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MappableRecord() | |
typedef Shop = ({ | |
String id, | |
String name, | |
DateTime createdAt, | |
String address, | |
}); | |
final res = await Amplify.API | |
.query( | |
request: GraphQLRequest( | |
document: '''query GetShop(\$id: ID!) { | |
getShop(id: \$id) { | |
id | |
name | |
createdAt | |
address | |
} | |
}''', | |
variables: <String, String>{'id': '637428c2-a001-70c6-8c8f-51f888538d1b'}, | |
), | |
) | |
.response; | |
final shop = ShopMapper.fromMap(jsonDecode(res.data)["getShop"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment