“http dart” Kode Jawaban

http dart

//pub dependency
http: ^0.13.2

//import
import 'package:http/http.dart' as http;
Distinct Dolphin

Klien Dart Httop

import 'package:http/http.dart' as http;

var url = 'https://example.com/whatsit/create';
var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');

print(await http.read('https://example.com/foobar.txt'));
Grumpy Gorilla

Klien Dart Httop

var client = http.Client();
try {
  var uriResponse = await client.post('https://example.com/whatsit/create',
      body: {'name': 'doodle', 'color': 'blue'});
  print(await client.get(uriResponse.bodyFields['uri']));
} finally {
  client.close();
}
Grumpy Gorilla

Jawaban yang mirip dengan “http dart”

Pertanyaan yang mirip dengan “http dart”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya