I am new to flutter and getting The following No Such Method Error was thrown building Consumer<Cart Item Counter New>: The getter 'length' was called on null

this is where error is showing
child: Consumer(
builder: (context,_counter, _) {
return Text(
(EcommerceApp.sharedPreferences
.getStringList(
EcommerceApp.userCartList)
.length-1).toString(),
style: TextStyle(
color: Colors.white,
fontSize: 12.0,
fontWeight: FontWeight.w500),
);
},
),
this is my cart item counter
class CartItemCounterNew extends ChangeNotifier
{
int _counter = EcommerceApp.sharedPreferences.getStringList(EcommerceApp.userCartList).length-1;
int get count => _counter;

Future displayResult() async
{
_counter = EcommerceApp.sharedPreferences.getStringList(EcommerceApp.userCartList).length-1;

await Future.delayed(const Duration(milliseconds: 100), (){
  notifyListeners();
});

}
}
this is my cartlist in login screen
List cartList =
dataSnapshot.data[EcommerceApp.userCartList].cast();

  await EcommerceApp.sharedPreferences
      .setStringList(EcommerceApp.userCartList, cartList);