Flutter "argument type not assignable" Error with two identical types

1,985

It was a double slash in the import statement that generated this strange error.

Share:
1,985
LateBoy
Author by

LateBoy

Updated on December 21, 2022

Comments

  • LateBoy
    LateBoy over 1 year

    Flutter shows me this error, but the two types are identical.

    [CartItem it's just a simple model; there was a conflict since another widget had the same name but I resolved it using "as" in the import statement]

    The argument type List<CartItems> (where CartItem is defined in /Users/marco/Documenti Locali/shop_app/lib/providers/cart.dart)' can't be assigned to the parameter type List<CartItems> (where CartItem is defined in /Users/marco/Documenti Locali/shop_app/lib/providers/cart.dart)'.dartargument_type_not_assignable

    list.dart(56, 16): List is defined in /Users/marco/flutter/bin/cache/pkg/sky_engine/lib/core/list.dart

    cart.dart(3, 7): CartItem is defined in /Users/marco/Documenti Locali/shop_app/lib/providers/cart.dart

    list.dart(56, 16): List is defined in /Users/marco/flutter/bin/cache/pkg/sky_engine/lib/core/list.dart

    cart.dart(3, 7): CartItem is defined in /Users/marco/Documenti Locali/shop_app/lib/providers/cart.dart

    Peek Problem (⌥F8) No quick fixes available