“http dart” Code-Antworten

http dart

//pub dependency
http: ^0.13.2

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

DART HTTOP -Client

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

DART HTTOP -Client

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

Ähnliche Antworten wie “http dart”

Fragen ähnlich wie “http dart”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen