The argument type 'Widget Function(BuildContext, Object?)' can't be assigned to the parameter type 'Widget Function(BuildContext, dynamic, VxStatus?

679

This line:

 builder: (context, _ ){

You are declaring a function, this function takes 3 arguments, but you are only passing 2, add a third argument:

 builder: (context, _, __) {
Share:
679
Admin
Author by

Admin

Updated on November 26, 2022

Comments

  • Admin
    Admin over 1 year
    [Issue 1 :)'. ][1]
    

    The argument type 'Widget Function(BuildContext, Object?)' can't be assigned to the parameter type 'Widget Function(BuildContext, dynamic, VxStatus?

    Trying to update the cart total using Vxbuilder or Vxconsumer but this errors pops in

    class _CartTotal extends StatelessWidget {
      final CartModel _cart = (VxState.store as MyStore).cart;
      @override
      Widget build(BuildContext context) {
        return SizedBox(
          height: 200,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: [
              VxBuilder(
                mutations: {RemoveMutation},
                //notifications: {},
                builder: (context, _ ){
                return "\$${_cart.totalPrice}"
                  .text
                  .xl5
                  .color(context.theme.accentColor)
                  .make();
              }, 
              );
              30.widthBox,
              TextButton(
                      onPressed: () {
                        ScaffoldMessenger.of(context).showSnackBar(SnackBar(
                          content: "Buying not supported yet".text.center.make(),
                        ));
                      },
                      style: ButtonStyle(
                          backgroundColor:
                              MaterialStateProperty.all(context.theme.buttonColor)),
                      child: "Buy".text.xl3.color(Colors.black).make())
                  .w32(context),
            ],
          ),
        );
      }
    }
    '''
    
    • Yeasin Sheikh
      Yeasin Sheikh about 2 years
      Can you include your code-snippet?
  • Nabeel Ahmed
    Nabeel Ahmed almost 2 years
    It's other way around. I just remove the second argument and it worked.