简体   繁体   中英

type 'Null' is not a subtype of type 'String' in flutter

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

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

Text(categoryTitle??"")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM