Skip to content

Instantly share code, notes, and snippets.

@TetsuFe
Last active June 27, 2020 05:56
Show Gist options
  • Save TetsuFe/d3fe877a61923774649026e33c3f2018 to your computer and use it in GitHub Desktop.
Save TetsuFe/d3fe877a61923774649026e33c3f2018 to your computer and use it in GitHub Desktop.
Got an error: Uncaught Error: Unsupported operation: Platform._version
import 'dart:convert';
import 'dart:io';
void main() async {
final parsedUri =
Uri.parse('https://run.mocky.io/v3/ff312e74-ac17-49ee-9ce3-8638d7329917');
// DartPad error will be occured!
final myAccountRequest = await HttpClient().getUrl(parsedUri);
final myAccountResponse = await myAccountRequest.close();
final myAccountJsonString = await utf8.decodeStream(myAccountResponse);
final myAccount = jsonDecode(myAccountJsonString);
// display foobar
print(myAccount['username']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment