Created
November 13, 2019 10:59
-
-
Save Hellomik2002/3961ef5b3fe01e6c846116b2782b4ba0 to your computer and use it in GitHub Desktop.
This file contains 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
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