Skip to main content

ERRORS in flutter

The argument type 'String?' can't be assigned to the parameter type 'String'.dartargument_type_not_assignable

caution

Solution: Add a null check ! at the end of that particular String

class BookDetails extends StatelessWidget {
const BookDetails({
Key? key,
required this.currentBook,
}) : super(key: key);

final Map<String, String> currentBook;


Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(currentBook['bookTitle']), ❌❌❌❌❌❌ // The argument type 'String?' can't be assigned to the parameter type 'String' ... `dartargument_type_not_assignable`
title: Text(currentBook['bookTitle']!), /// NULL CHECK Operator `!` ✅✅✅✅

),
);
}
}