Skip to content

Instantly share code, notes, and snippets.

@Hellomik2002
Created November 13, 2019 10:59
Show Gist options
  • Save Hellomik2002/3961ef5b3fe01e6c846116b2782b4ba0 to your computer and use it in GitHub Desktop.
Save Hellomik2002/3961ef5b3fe01e6c846116b2782b4ba0 to your computer and use it in GitHub Desktop.
Future<String> updateInstitution(
final String institutionId, final Asset file) async {
final String filePath = await file.filePath;
dev.log(filePath, name: "Ulan", sequenceNumber: 15, zone: Zone.root);
final MultipartFile multipartFile = await MultipartFile.fromPath('photo', filePath, filename: file.name, contentType: MediaType("image", "jpg"),);
print(multipartFile.filename);
final document = '''
mutation update(\$postBackgound: Upload!){ addDataInstitution(token:"", institutionId: $institutionId imageBackground: \$postBackgound ){
imageBackgroundUrl
}
}
''';
dev.log(document, name: "WTF", zone: Zone.root);
dev.log(multipartFile.filename);
print('ohhh');
final QueryResult result = await GraphqlConnection.connection().mutate(
MutationOptions(
document: document,
variables: {
'postBackgound': multipartFile
},
fetchPolicy: FetchPolicy.networkOnly
),
);
print(result.data);
print(result.errors);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment