onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() {
super.onInit();
_dio =
Dio(
BaseOptions(
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'api-key': CommunityConstants.apiKey,
},
),
)
..interceptors.add(
LogInterceptor(
requestBody: true,
responseBody: true,
requestHeader: true,
),
);
}