-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type '(BuildContext) => Future<void>' is not a subtype of type '() => void' #46595
Comments
Hi @daniele777 @override
Widget build(BuildContext context) {
MaterialApp(
home: Scaffold( try adding @override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold( This platform is not meant for assistance on personal code. |
Unfornunally same problem...another idea??? |
Solve issue thx |
Hi @daniele777 |
Hy guys my code… class chiese {
final String nome;
final double x;
final double y;
final String imaggine;
final String info;
chiese({this.nome, this.x, this.y, this.imaggine, this.info});
factory chiese.fromJson(Map<String, dynamic> json) {
return new chiese(
nome: json[‘nome’] as String,
x: json[‘x’] as double,
y: json[‘y’] as double,
imaggine: json[‘imaggine’] as String,
info: json[‘info’] as String,
);
}
}
Future _loadAStudentAsset() async {
return await rootBundle.loadString(‘assets/json/chiese.json’);
}
Future loadStudent() async {
await wait(5);
String jsonString = await _loadAStudentAsset();
final jsonResponse = json.decode(jsonString);
}
Future wait(int seconds) {
return new Future.delayed(Duration(seconds: seconds), () => {});
}
class _FirstScreen extends State {
BitmapDescriptor pinLocationIcon;
chiese _chiese;
@override
void initState(){
super.initState();
loadStudent().then((s) => setState(() {
_chiese = s;
_loaded = true;
_addchiese();
}));
_addchiese() async {
await wait(5);
String jsonString = await _loadAStudentAsset();
final jsonResponse = json.decode(jsonString);
for ( var i=0; i < 8; i++ ){
new chiese.fromJson(jsonResponse[i]);
print(jsonResponse[i]);
int _markerIdCounter= 0;
final String markerIdVal = 'marker_id_$_markerIdCounter';
_markerIdCounter++;
final MarkerId markerId = MarkerId(markerIdVal);
final Marker marker = Marker(
position: LatLng(_chiese.y, _chiese.x),
icon: pinLocationIcon,
/*
infoWindow:
InfoWindow(title: “Informazioni”, snippet: _chiese.nome+"\n"+_chiese.info),
*/
markerId: markerId,
);
setState(() {
// adding a new marker to map
markers[markerId] = marker;
});
}
}
But only first row of Json file was readed… any idea??? Json file have 20 rows- like this
[{“nome”: “Chiesa SAN MARTINO”,“x”: 12.887840,“y”: 42.2059400,“imaggine”:"",“info”:""},
{“nome”:“Chiesa VICTORIA”,“x”: 12.870703,“y”: 42.226254,“imaggine”:"",“info”:""}] |
Whit my code show only firts {. } Row of json and Vector not ho ahead ...and only One marker i saw ...at second Return null |
Hi @daniele777 Please see https://flutter.dev/community for resources for asking questions like this, |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
My part of code where error should be generated...
code sample
help!
logs
The text was updated successfully, but these errors were encountered: