I follow the Doc, but get some error.
Asked
Active
Viewed 1,145 times
1 Answers
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
-
thanks, as you said, I put it in function, it works. – mengqiao hu Sep 16 '18 at 11:53