How to write to an HTML element from the server in Dart
It's quite common to build web applications that pull in data from other web applications, initiated by logic that performs HTTP calls to third party services.
lets look at how we can use the inbuilt HttpRequest classes to make HTTP calls to external services.
index.html
<!DOCTYPE html><html> <head> <title>A Minimalist App</title> </head> <body> <div id="output">Hi</div> // I want the "hello" to go here <script type="application/dart" src="main.dart"></script> <script src="packages/browser/dart.js"></script> </body></html>
main.dart
import 'dart:html';void main() { var response = await HttpRequest.getString('http://localhost:8080') querySelector('#output').text = response;}
For more info visit here
Thanks. :) , hope it helps.