Flutter stuck on Building Dart code after doing flutter build ios
Date : March 29 2020, 07:55 AM
it helps some times That's an issue that was fixed very recently and the fix should already be available in the master channel. flutter channel master
flutter doctor
|
Flutter: I got stuck with a problem in Flutter. I think the problem is the card that does not adapt dynamically
Date : March 29 2020, 07:55 AM
wish helps you The build function for Assegno should have a Flexible or an Expanded widget in it like this: @override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Flexible(child: Card(child: _buildAssegnoList(context)))
],
);
}
|
How to Fix the error "The following assertion was thrown building FutureBuilder<List<Event>>(dirty, sta
Tag : dart , By : Marcos de Carvalho
Date : March 29 2020, 07:55 AM
I hope this helps you . The problem is that when your FutureBuilder returns with no data (when the FutureBuilder is first loaded) you do not return a widget. Try changing your FutureBuilder like so: FutureBuilder(
future: fetchPosts(new http.Client()),
builder: (BuildContext context, AsyncSnapshot<List<Event>> snapshot) {
if (snapshot.hasData) {
return ListViewPosts(events: snapshot.data);
}
return CircularProgressIndicator();
},
)
|
The following assertion was thrown building Navigator
Date : March 29 2020, 07:55 AM
Does that help Can I navigate to another widget when the first one is being built? import 'package:flutter/material.dart';
main()=>runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MyApp',
initialRoute: '/',
routes: {
'/': (context) => Screen0(),
'/home': (context) => MyHomePage(),
},
);
}
}
class Screen0 extends StatefulWidget {
@override
_Screen0State createState() => _Screen0State();
}
class _Screen0State extends State<Screen0> {
@override
void initState() {
changeScreen();
super.initState();
}
void changeScreen() {
// The delay fixes it
Future.delayed(Duration(milliseconds: 5000)).then((_) {
Navigator.pushReplacementNamed(context, '/home');
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text('First Screen'),
),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(''),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
|
EXCEPTION CAUGHT BY WIDGETS LIBRARY flutter: The following assertion was thrown building PhotosList(dirty, state: _Photo
Date : March 29 2020, 07:55 AM
I hope this helps you . No.of DataColumn (headings) and No.of DataCell in each row should be same. In your code, you missing a column heading "State Latest Price" (2nd Column heading) Widget bodyData() =>
DataTable(
sortColumnIndex: 1,
sortAscending: true,
columns: <DataColumn>[
DataColumn(
label: Text("Company Name"),
onSort: (_, __) {
setState(() {
widget.photos.sort((a, b) =>
a.data["quote"]["companyName"]
.compareTo(b.data["quote"]["companyName"]));
});
},
),
DataColumn(
label: Text("Stats Latest Price"),
onSort: (_, __) {
setState(() {
widget.photos.sort((a, b) =>
a.data["stats"]["latestPrice"]
.compareTo(b.data["stats"]["latestPrice"]));
});
},
),
DataColumn(
label: Text("Dividend Yield TT"),
onSort: (_, __) {
setState(() {
widget.photos.sort((a, b) =>
a.data["stats"]["dividendYield"]
.compareTo(b.data["stats"]["dividendYield"]));
});
},
),
DataColumn(
label: Text("IEX Bid Price"),
onSort: (_, __) {
setState(() {
widget.photos.sort((a, b) =>
a.data["quote"]["iexBidPrice"]
.compareTo(b.data["quote"]["iexBidPrice"]));
});
},
),
DataColumn(
label: Text("Latest Price"),
onSort: (_, __) {
setState(() {
widget.photos.sort((a, b) =>
a.data["quote"]["latestPrice"]
.compareTo(b.data["quote"]["latestPrice"]));
});
},
),
],
rows: widget.photos
.map(
(photo) =>
DataRow(
cells: [
DataCell(
Text('${photo.data["quote"]["companyName"] ?? ""}'),
),
DataCell(
Text("Last Price:"
'${photo.data["stats"]["latestPrice"] ?? ""}'),
),
DataCell(
Text("Dividend Yield22:"
'${photo.data["stats"]["dividendYield"] ?? ""}'),
),
DataCell(
Text("Last Price:"
'${photo.data["quote"]["iexBidPrice"] ?? ""}'),
),
DataCell(
Text("Last Price:"
'${photo.data["quote"]["latestPrice"] ?? ""}'),
),
],
),
)
.toList());
|