Answer the question
In order to leave comments, you need to log in
Dart, invalid constructor name?
Hello everyone, I'm writing a lightweight class to get data from the API I
just started to understand the dart
class
import 'package:http/http.dart' as http;
class api_model {
String base_url = 'http://*/Callback/';
String api_key = '*';
String getCodes()
{
this._request('getCodes');
}
String _request(String method, {Map<String, String> params})
{
http.post(base_url+'/'+method+'/'+api_key, body: params)
.then((response) {
print("Response status: ${response.statusCode}");
print("Response body: ${response.body}");
});
}
}
api_model apiModel = new api_model();
apiModel.getCodes();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question