Closed ndemeyvan closed 4 years ago
Thank you Mr @alexrindone but i have the same probleme :
I get Some data from Future
if ( response.statusCode == 200) { List jsonResponse = json.decode(utf8.decode(response.bodyBytes))['data']; print(" 200 response /getSearchProduct : ${jsonResponse}"); if( jsonResponse.length == 0){ return [ ]; } else { List displayableList = new List(); for(int i =0 ; i< jsonResponse.length;i++){ print("Response value : ${jsonResponse[i]['name']}"); displayableList.add(jsonResponse[i]['name']); } print("displayList : $displayableList"); return displayableList; } }
And I try to get it in TextFieldSearch :
TextFieldSearch( label: "label", controller: searchForProductController , future: () { return api.getSearchProduct(context: context, searchItem: searchForProductController.text); }, getSelectedValue: (value) { print("The selected Value : $value"); // this prints the selected option which could be an object } ),
But i get this error : but i still have this error ([ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: Class 'String' has no instance getter 'label'.) with the version 0.7.0, what am i doing wrong?
I don't know why this library do it but you need to create a list of TestItem with "label" property rather than List of String. Because it do call list[i].label to check the search item. I hope it will write clearly in the document. Btw, this problem exist 2 years without fixed
I don't think it is a bug. More like a missing info in the documentation.
@ndemeyvan thank you for opening the issue and thank you for being the first other than myself to open an issue! I hope that you find my bug fixes solve your issue and thank you again for bringing it to my attention.