“Dart http” Respostas de código

Dart http

//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

Respostas semelhantes a “Dart http”

Perguntas semelhantes a “Dart http”

Procure respostas de código populares por idioma

Procurar outros idiomas de código