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
NoSuchMethodError: The method '>' was called on null. #21628
Comments
Could you please create a complete runnable example (main.dart) that allows to reproduce? |
I creat a example , this is all of the main.dart。 when i run , i get the same error : import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
_cancle(){
}
String _validate(String value) {
return null;
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('test'),
automaticallyImplyLeading: false,
actions: <Widget>[
new IconButton(icon: new Icon(Icons.close), onPressed: _cancle),
],
),
body: new Container(
color: Colors.blue,
padding: const EdgeInsets.all(12.0),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new TextFormField(
keyboardType: TextInputType.text,
validator: _validate,
textCapitalization: TextCapitalization.words,
obscureText: false,
decoration: new InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
filled: true,
hintText: 'test',
labelText: 'test',
hintStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
labelStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
),
),
const SizedBox(height: 10.0),
new TextFormField( // new Text('test'), // this place !!!! if the widget is Text . it can word
keyboardType: TextInputType.text,
validator: _validate,
textCapitalization: TextCapitalization.words,
obscureText: false,
decoration: new InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
filled: true,
hintText: 'test',
labelText: 'test',
hintStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
labelStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
),
),
new Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new TextFormField( // new Text('test'), // this place !!!! if the widget is Text . it can word
keyboardType: TextInputType.text,
validator: _validate,
textCapitalization: TextCapitalization.words,
obscureText: false,
decoration: new InputDecoration(
fillColor: Colors.white,
border: InputBorder.none,
filled: true,
hintText: 'test',
labelText: 'test',
hintStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
labelStyle:
TextStyle(color: Color(0x73000000), fontSize: 14.0),
),
),
],
),
],
),
));
}
}
|
Thanks a lot for the reproduction code. With this code I get
with
Looks like yours, but
is missing. |
Adding a new Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Flexible(
child: new TextFormField( Tentatively closing. Add a comment to reopen if you disagree. |
I/flutter ( 4598): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ 🔥 To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R". Initializing hot reload... Reloaded 0 of 455 libraries in 3,687ms. I/flutter ( 4598): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#b9ed0 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE how do i solve this I m also new one in flutter gang plzzzzzzzzzz help |
I got a very similar error recently. In my case, I was running a forloop inside the children property of a Column widget. What I did wrong? for(int i; i<data.length; i++) so I is really null and I am running "<" against null. |
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 |
Steps to Reproduce
this is my code :
Logs
when i run . I got this error:
but if i used Text widget , it can worked.
flutter doctor -v
The text was updated successfully, but these errors were encountered: