get static method
Sends an HTTP GET request with the given headers to the given URL.
This automatically initializes a new http.Client
and closes that client once the request is complete. If you're planning on making multiple requests to the same server, you should use a single http.Client
for all of those requests.
指定されたヘッダーを含む HTTP GET 要求を指定された URL に送信します。
これにより、新しい http.Client
が自動的に初期化され、リクエストが完了するとそのクライアントが閉じられます。同じサーバーに複数のリクエストを送信する予定がある場合は、それらすべてのリクエストに対して単一の http.Client
を使用する必要があります。
Implementation
static Future<ApiResponse> get(
String path, {
Map<String, String>? headers,
}) async {
final url = Uri.parse(path);
return http.get(
url,
headers: headers,
);
}