Home > Enterprise >  argument type 'Null' can't be assigned to the parameter type FLUTTER GETX
argument type 'Null' can't be assigned to the parameter type FLUTTER GETX

Time:08-25

Hello I'm a new flutter user by trying the getx method, this time I have a problem when I want to call the view, the error says `

The argument type 'Null' can't be assigned to the parameter type 'ApiRepository'.

To solve this problem, do you think anyone can help me to solve this problem?

Here is the code snippet

main_tab.dart (This Error)

enter image description here

home_controller.dart

enter image description here

CodePudding user response:

The error message says clearly.

Your param apiRespostiry can't access a null value.

So, you can do two things:

  1. Don't pass a null value
  2. use ? => final ApiRepository? apiRepository
  • Related