Issue
Code will explain all:
class ResultOverlay extends StatefulWidget {
final bool _isCorrect;
VoidCallback _onTap;
ResultOverlay(this._isCorrect, this._onTap);
......
......
}
Its state class:
class ResultOverlayState extends State<ResultOverlay>{
@override
Widget build(BuildContext context) {
........
child: new InkWell(
onTap: () => widget._onTap,
.....
.....
}
Passing of callback function:
new ResultOverlay(isCorrect, () {
() => CallAnswerPage();
})
What I am missing here?
Solution
I was not passing the callback correctly. Here is the correct syntax:
new ResultOverlay(
isCorrect,
() => callAnswerPage()
)
So silly mistake :)
Answered By - pallav bohara Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.