Hexaminate Library
Install
flutter pub add hexaminate
dart pub add hexaminate
Documentation
Api
Fetch
quickstart:
import 'dart:convert';
import 'package:hexaminate/hexaminate.dart';
void main() async {
FetchResponse res = await fetch("https://api.example.com", {
"method": "post",
"headers": {"Content-Type": "application/json"},
"body": json.encode({"key": "value"})
});
print(res.body());
}
constructor
return Fetch Response
No | key | value | Deskripsi | required |
---|---|---|---|---|
1 | url |
String path url | yes |
|
2 | options |
object | parameters di butuhkan jika method membutuhkannya |
no |
- examples
fetch("https://api.example.com", {
"method": "post",
"headers": {
"Content-Type": "application/json"
},
"body": json.encode({
"key": "value"
})
});
FetchResponse
statusCode
return status int
from api
No | key | value | Deskripsi | required |
---|
FetchResponse res = await fetch("url");
print(res.statusCode);
body
return Object
or text
from api
No | key | value | Deskripsi | required |
---|
FetchResponse res = await fetch("url");
print(res.body());
Server
quickstart:
import 'dart:convert';
import 'dart:io';
import 'package:hexaminate/hexaminate.dart';
void main() async {
Server app = Server();
app.on("/", (RequestApi req, ResponseApi res) async {
return res.send("api normal");
});
app.get("/json", (RequestApi req, ResponseApi res) async {
return res.send({"value": "json"});
});
app.listen(callback: (HttpServer server) {}, port: 8080, host: "0.0.0.0");
}
constructor
No | key | value | Deskripsi | required |
---|
- examples
Server();