0
Widget build(BuildContext context) {
final routeArgs =
    ModalRoute.of(context).settings.arguments as Map<String, String>;
final categoryTitle = routeArgs['title'];
final categoryId = routeArgs['id'];
return Scaffold(
  appBar: AppBar(
    title: Text(categoryTitle),
  ),

Please help me with this This is the error I'm facing with

2
  • I suspect that categoryTitle is null, so just check for null title: (categoryTitle != null ? Text(categoryTitle) : "Default title"), Commented Nov 29, 2021 at 14:18
  • routeArgs['title'] is null so check upstream. Commented Nov 29, 2021 at 14:20

1 Answer 1

2

i think your routeArgs['title'] is null and when you put it in text it is generating error try

Text(categoryTitle??"")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.