Nikita,
I’m completely confused; the Flutter SDK downloaded to me (class CodelessShoppingCartService – see below) is completely different from the “correct signature” (class Variables) you posted above. I note the API service has six functions (getInstructions, etc.) whereas class Variables has just two. What am I missing?
I changed the parameter type because all of the parameter calls are type List< Object > whereas the parameter type defs are simple variables (string or Map). This type mismatch causes the IDE error
“The argument type ‘String’ can’t be assigned to the parameter type ‘List’.”
You said you are “unable to reproduce your error”; is that by running the complete app posted at
CodelessShoppingCartService.zip - Google Drive ?
Jim
Note: the Flutter SDK download also includes a main function that has to be enhanced to call the four functions needed to complete this task.
import ‘package:backendless_sdk/backendless_sdk.dart’;
class CodelessShoppingCartService {
static final _serviceName = “CodelessShoppingCartService”;
static Future<dynamic> getInstructions() {
final parameters = Map();
return Backendless.customService.invoke(_serviceName, "getInstructions", parameters);
}
static Future<dynamic> getItems(String cartName) {
final parameters = cartName;
return Backendless.customService.invoke(_serviceName, "getItems", parameters);
}
static Future<dynamic> purchase(String cartName) {
final parameters = cartName;
return Backendless.customService.invoke(_serviceName, "purchase", parameters);
}
static Future<dynamic> addItem(String cartName, Object item) {
final parameters = {"cartName": cartName, "item": item};
return Backendless.customService.invoke(_serviceName, "addItem", parameters);
}
static Future<dynamic> deleteItem(String cartName, String productName) {
final parameters = {"cartName": cartName, "productName": productName};
return Backendless.customService.invoke(_serviceName, "deleteItem", parameters);
}
static Future<dynamic> setQuantity(String cartName, String productName, double quantity) {
final parameters = {"cartName": cartName, "productName": productName, "quantity": quantity};
return Backendless.customService.invoke(_serviceName, "setQuantity", parameters);
}
static Future<dynamic> Items(String cartName, List<dynamic> items) {
final parameters = {"cartName": cartName, "items": items};
return Backendless.customService.invoke(_serviceName, "Items", parameters);
}
}