I am using null safety in my flutter app and i am trying to map a map to a walkthrough screen widget. I have looked and not seen solutions online. Here is my map
final pageViewModel = [
{
'title': 'Budget Your Funds And Save Up',
'subtitle': 'Save Up Your Money Over A Period Of Time and Get',
'image': 'assets/images/budget.svg'
},
{
'title': 'Transfer Funds At Almost No Cost',
'subtite': 'Our Transfer Rates Are At Absolutely No Cost.',
'image': 'assets/images/finance.svg'
},
{
'title': 'Get Free Virtual Cards',
'subtitle': 'Your Days Of Going To The Bank Is Over'
}
];
Then in my build method I am using this map list to create a pageviewmodel like so
IntroductionScreen(
pages: pageViewModel
.map((page) => PageViewModel(
titleWidget: Text(
page['title'], //Here is the line causing the error
textAlign: TextAlign.center,
style: TextStyle(
color: secondaryColor,
fontWeight: FontWeight.w800,
fontSize: 25.0),
),
body:
"Here you can write the description of the page, to explain someting...",
image: SvgPicture.asset(
'assets/images/budget.svg',
height: 400,
),
))
.toList(),
The error i get is
The argument type 'String?' can't be assigned to the parameter type 'String'
Any help will be appreciated.