"सही लग रहा है", यह संकलित है, लेकिन नहीं चलता है, सांत्वना संदेश के साथ असफल रहने के लिए नीचे दिए गए कोड:मैं डार्ट आयात कैसे करूं: एचटीएमएल और डार्ट: io एक ही कक्षा में?
Cannot load Dart script dart:io
Failed to load resource
अगर मैं #import('dart:io');
बाहर टिप्पणी, गलत मुझे विश्वास है, मैं एक संकलन त्रुटि है, लेकिन यह लॉन्च करता है और जब तक मैं बटन दबाता हूं, मुझे रनटाइम त्रुटि मिलती है:
Internal error: 'http://127.0.0.1:3030/home/david/dart/samples/htmlIO/htmlIO.dart': Error: line 13 pos 26: type 'HttpClient' is not loaded
var connection = new HttpClient().get('www.google.com', 80, '/');
... जो अपेक्षित है।
तो मेरा सवाल है: मैं डार्ट आयात कैसे करूं: एचटीएमएल & डार्ट: एक ही कक्षा में io? जबकि dart:io
एक सर्वर साइड पुस्तकालय है
#import('dart:html');
#import('dart:io');
class htmlIO {
ButtonElement _aButton;
htmlIO() {
}
void handlePress(Event e) {
var connection = new HttpClient().get('www.google.com', 80, '/');
write('made it');
}
void run() {
_aButton = document.query("#aButton");
_aButton.on.click.add(handlePress);
write("Hello World!");
}
void write(String message) {
// the HTML library defines a global "document" variable
document.query('#status').innerHTML = message;
}
}
void main() {
new htmlIO().run();
}