Flutterでネットワーク通信
はじめに
覚書のために書いています。
使うパッケージ
- http
使い方
GET get(
) POST post(
, body: )
戻り値は Future< Response >
Responseの処理はFutureのthenメソッドにCallbackとして渡す。
余談
パッケージのインポートは
import 'package:http/http.dart' as http;
と書くが、
import 'package:http/http.dart'
と書くとネームスペースがグローバルになるみたい。
Dartの勉強がまだまだ。