0

enter image description here

I follow the Doc, but get some error.

mengqiao hu
  • 183
  • 1
  • 2
  • 10

1 Answers1

4

It would be useful if you repeated the error you get, but I'll make a guess at what the problem is.

The text dio.interceptor is not inside any function, constructor or variable initializer. You can only have expressions in those places, not at the top-level of a library.

At the point where you write dio.interceptor, you need to write a variable or function declaration. There is no valid declaration starting with dio.interceptor because it cannot be a type, so the analyzer will tell you that the program isn't valid and, likely, that a type is expected.

Whatever you are trying to do, put it inside a function, perhaps even a main function if this is the main file of your program.

lrn
  • 64,680
  • 7
  • 105
  • 121