Last active
December 5, 2018 18:20
-
-
Save chalin/5a0017d09b6823d0248d965b93133e2e to your computer and use it in GitHub Desktop.
Flutter for React Native devs: Dart Futures
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
import 'dart:convert'; | |
import 'dart:html'; | |
void main() { | |
_getIPAddress() { | |
final url = 'https://httpbin.org/ip'; | |
Future<HttpRequest> request = HttpRequest.request(url); | |
request.then((value) { | |
print(json.decode(value.responseText)['origin']); | |
}).catchError((error) => print(error)); | |
} | |
_getIPAddress(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment