Im using Chopper for calling api and i want to get result json, this is the API i want to call [https://api.jsonbin.io/b/5e1219328d761771cc8b9394]
I would like to ask how to resolve this kind of problem,
Unhandled Exception: NoSuchMethodError: The method 'inheritFromWidgetOfExactType' was called on null.
my class is
part 'APIService.chopper.dart';
@ChopperApi(baseUrl:"/b/")
abstract class ApiService extends ChopperService {
@Get(path: "5e1219328d761771cc8b9394")
Future<Response> getPost();
static ApiService create() {
final client = ChopperClient(
baseUrl: "https://api.jsonbin.io/",
services: [_$ApiService(),],
converter: JsonConverter());
return _$ApiService(client);
}
}
and then I'm calling this function to test the Chooper
void testAPI() async
{
final response = await Provider.of<ApiService>(context).getPost();
print(response.body);
}
But i having a problem and i cannot call testAPI can you help me ?
Thank you in advance, sorry for the grammar BTW,