getBuildConfig method
Implementation
Future<BuildInfo?> getBuildConfig() async {
final appwriteServer = AppwriteServer(environment);
final databases = appwriteServer.databases;
final documents = await databases.listDocuments(
databaseId: environment.databaseId,
collectionId: environment.collectionId,
queries: [
Query.equal('platform', platform),
Query.equal('branch', branch),
Query.equal('unity_branch', unityBranch),
Query.orderDesc('\$createdAt'),
],
);
if (documents.documents.isEmpty) {
return null;
}
final document = documents.documents.first;
final buildInfo = BuildInfo.fromJson({
'flutter': JSON(document.data)['flutter_conmit'].stringValue,
'unity': BuildUnityConfig.fromJson({
'cache': JSON(document.data)['unity_cache_commit'].stringValue,
'log': JSON(document.data)['unity_log_commit'].stringValue,
}).toJson(),
});
return buildInfo;
}