Skip to content

Instantly share code, notes, and snippets.

@plateaukao
Created March 8, 2020 08:53
Show Gist options
  • Save plateaukao/0290169592b4e60b7002da98b3c896ad to your computer and use it in GitHub Desktop.
Save plateaukao/0290169592b4e60b7002da98b3c896ad to your computer and use it in GitHub Desktop.
query google web app url and parse data
class NetworkClient {
Future<List<VocabData>> getVocabs(VocabConfiguration vocabConfig) async {
final url = "https://script.google.com/macros/s/script_id_xxxxxxxxxx/exec";
final response = await Dio().get(
url,
queryParameters: {
"id": vocabConfig.sheetId,
"range": vocabConfig.rangeName
}
);
List<VocabData> result = new List<VocabData>();
for (int index = 0; index < response.data.length ; index ++) {
final item = response.data[index];
result.add(VocabData(item[0], item[1], item[2], item[3]));
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment