I try to using searchdelgit with future list from JSON, when. But I got this error:
formatException :Unexpected character (at line 2 , character1)
altho I already use the same code without search page and it works perfectly
any idea guys
@override
Widget buildResults(BuildContext context) {
// show some result based on the selection
if (query.length < 3) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Center(
child: Text(
"Search term must be longer than two letters.",
),
)
],
);
}
return FutureBuilder(
future: _fetchProductSearch(query),
builder: (context, AsyncSnapshot<List<Products>> snapshot) {
if (!snapshot.hasData) {
return Text(snapshot.error.toString());
} else if (snapshot.data.length == 0) {
return Column(
children: <Widget>[
Text(
"No Results Found.",
),
],
);
} else {
var results = snapshot.data;
return ListView.builder(
itemCount: results.length,
itemBuilder: (context, index) {
var result = results[index];
return ListTile(
title: Text(result.artitle),
);
},
);
}
},
);
}
formatException :Unexpected character (at line 2 , character1)