Hello, i get the following error message:
data != null
"A non-null String must be provided to a Text widget."
I dont know why i get this error message, please help me...
<pre>import 'package:flutter/material.dart';
class UserHome extends StatefulWidget {
final String title;
UserHome({Key key, this.title}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<UserHome> {
int _selectedDestination = 0;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final textTheme = theme.textTheme;
return MaterialApp(
home: Scaffold(
body: Row(
children: [
Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'Header',
style: textTheme.headline6,
),
),
Divider(
height: 1,
thickness: 1,
),
ListTile(
leading: Icon(Icons.favorite),
title: Text('Item 1'),
selected: _selectedDestination == 0,
onTap: () => selectDestination(0),
),
ListTile(
leading: Icon(Icons.delete),
title: Text('Item 2'),
selected: _selectedDestination == 1,
onTap: () => selectDestination(1),
),
ListTile(
leading: Icon(Icons.label),
title: Text('Item 3'),
selected: _selectedDestination == 2,
onTap: () => selectDestination(2),
),
Divider(
height: 1,
thickness: 1,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'Label',
),
),
ListTile(
leading: Icon(Icons.bookmark),
title: Text('Item A'),
selected: _selectedDestination == 3,
onTap: () => selectDestination(3),
),
],
),
),
VerticalDivider(
width: 1,
thickness: 1,
),
Expanded(
child: Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: GridView.count(
crossAxisCount: 2,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
padding: EdgeInsets.all(20),
childAspectRatio: 3 / 2,
children: [
Image.asset('assets/nav-drawer-1.svg'),
Image.asset('assets/nav-drawer-2.svg'),
Image.asset('assets/nav-drawer-3.svg'),
Image.asset('assets/nav-drawer-4.svg'),
],
),
),
),
],
),
),
);
}
void selectDestination(int index) {
setState(() {
_selectedDestination = index;
});
}
}
What I have tried:
I searched for this topic in the internet and found out that a variable is empty but i dont know which of these i using it is.