can we send raw json in get method in flutter
import 'package:http/http.dart' as http;
import 'dart:convert';
class API
{
//replace with your endpoint
static String BASE_URL = 'https://some-url/api/';
static Future<List<ExampleData>> getRequest() async {
Response res = await http.get(BASE_URL+'example');
if (res.statusCode == 200) {
List<dynamic> body = jsonDecode(res.body);
// complete by parsing the json body return into ExampleData object and return
//.................
}
}
}
final queryParameters = {
'name': 'Bob',
'age': '87',
};
final uri = Uri.http('www.example.com', '/path', queryParameters);
final headers = {HttpHeaders.contentTypeHeader: 'application/json'};
final response = await http.get(uri, headers: headers);
Also in JavaScript:
- display amount with currency for jquery
- check if all elements in array match a condition javascript
- format string javascript
- javascript the difference between innerText vs. innerHTML vs. textContent
- how to create multiple folders at once in node js
- javascript array remove last
- jquery clear text in div
- last element id javascript
- how to get a due date from current date in javascript
- how to compare strings in javascript ignoring case sensitive
- update node.js dependencies
- click a link using jquery
- javascript get last n characters of string
- CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker"
- javascript for loops
- js redirect to relative url
- RFC8259 json
- js array contains
- how to use react router
- npm i material ui
- discord.js command prompt notification
- remove or replacing element array in javascript
- how to reload the same page using javascript
- how map work in react