Error No.1 :
error: 'Null' doesn't conform to the bound 'BlocBase<Object?>' of the type parameter 'T'. (type_argument_not_matching_bounds
Error No.2 :
error: Couldn't infer type parameter 'T'.
Tried to infer 'Null' for 'T' which doesn't work:
Type parameter 'T' is declared to extend 'BlocBase<Object?>' producing 'BlocBase<Object?>'.
The type 'Null' was inferred from:
Parameter 'create' declared as 'T Function(BuildContext)'
but argument is 'Null Function(BuildContext)'.
Consider passing explicit type argument(s) to the generic.
(could_not_infer at [g_movies] lib\layout\movies_layout.dart:12)
class MoviesLayout extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( create: (BuildContext context) { MoviesCubit()..getTopRatedData(); }, child: BlocConsumer<MoviesCubit, MoviesStates>( listener: (context, state) {}, builder: (context, state) { return Scaffold( appBar: AppBar( title: Text( 'GMovies', style: GoogleFonts.oswald( fontWeight: FontWeight.bold, fontSize: 24, color: defaultColor, ), ), actions: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: CircleAvatar( radius: 20, child: IconButton( icon: Icon(Icons.person), onPressed: () {}, ), ), ), ], ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(20.0), child: Column( children: [ ExpandablePanel( theme: ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, ), header: Row( children: [ Text( 'Top Rated', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 22, ), ), SizedBox( width: 5, ), Text( 'Movies', style: TextStyle( fontSize: 22, ), ), ], ), collapsed: SizedBox( height: 2, ), expanded: SizedBox( width: double.infinity, height: 200, child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, itemBuilder: (context, index) => movieItem(), separatorBuilder: (context, index) => SizedBox( width: 10, ), itemCount: 10, ), ), ), SizedBox( height: 10, ), ExpandablePanel( theme: ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, ), header: Row( children: [ Text( 'Popular', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 22, ), ), SizedBox( width: 5, ), Text( 'Movies', style: TextStyle( fontSize: 22, ), ), ], ), collapsed: SizedBox( height: 2, ), expanded: SizedBox( width: double.infinity, height: 200, child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, itemBuilder: (context, index) => movieItem(), separatorBuilder: (context, index) => SizedBox( width: 10, ), itemCount: 10, ), ), ), SizedBox( height: 10, ), ExpandablePanel( theme: ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, ), header: Row( children: [ Text( 'Coming', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 22, ), ), SizedBox( width: 5, ), Text( 'Soon', style: TextStyle( fontSize: 22, ), ), ], ), collapsed: SizedBox( height: 2, ), expanded: SizedBox( width: double.infinity, height: 200, child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, itemBuilder: (context, index) => movieItem(), separatorBuilder: (context, index) => SizedBox( width: 10, ), itemCount: 10, ), ), ), SizedBox( height: 10, ), ExpandablePanel( theme: ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, ), header: Row( children: [ Text( 'Now', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 22, ), ), SizedBox( width: 5, ), Text( 'Playing', style: TextStyle( fontSize: 22, ), ), ], ), collapsed: SizedBox( height: 2, ), expanded: SizedBox( width: double.infinity, height: 200, child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, itemBuilder: (context, index) => movieItem(), separatorBuilder: (context, index) => SizedBox( width: 10, ), itemCount: 10, ), ), ), ], ), ), ), ); }, ), ); }