THIS IS MY CODE this is the app for storing data into google spreadsheets.
// showing red line under plus OPERATOR '+' in LINE
import 'dart:convert' as convert;
import 'package:store_data/models/update.dart';
import 'package:http/http.dart' as http;
class FormController {
// Callback function to give response of status of current request.
final void Function(String) callback;
var url = Uri.parse('https://script.google.com/macros/s/AKfycbzFd5Cw0itASDzFgIrdr97j8PbfWHw1iVcoJWhbChPKfO2c2sA/exec');
static const STATUS_SUCCESS = "SUCCESS";
FormController(this.callback);
void submitForm(Update update) async{
try{
await http.get(
url + update.toParams()).then(
(response){
callback(convert.jsonDecode(response.body)['status']);
});
} catch(e){
print(e);
}
}
}'
I'm not sure.Try
var url ='...';
then
void submitForm(Update update) async{
url+=update.toParams();
Uri uri = Uri.paste(url);
try{
await http.get(
uri).then(
(response){
callback(convert.jsonDecode(response.body)['status']);
});
} catch(e){
print(e);
}
You can try
var url =
'https://script.google.com/macros/s/AKfycbzFd5Cw0itASDzFgIrdr97j8PbfWHw1iVcoJWhbChPKfO2c2sA/exec';
static const STATUS_SUCCESS = "SUCCESS";
void submitForm(Update update) async {
try {
await http.get(Uri.parse(url + update.toParams()).then((response) {
callback(convert.jsonDecode(response.body)['status']);
}));
} catch (e) {
print(e);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.