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),
),
categoryTitleis null, so just check for nulltitle: (categoryTitle != null ? Text(categoryTitle) : "Default title"),