Skip to content

Instantly share code, notes, and snippets.

@bschulz87
Created August 26, 2024 09:33
Show Gist options
  • Save bschulz87/cb0681a6082049ee4da18bf88a5742ed to your computer and use it in GitHub Desktop.
Save bschulz87/cb0681a6082049ee4da18bf88a5742ed to your computer and use it in GitHub Desktop.
@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