Skip to content

Instantly share code, notes, and snippets.

@marcossevilla
Created April 17, 2021 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcossevilla/07e19ae771ad81b2dcd9026cb2f72473 to your computer and use it in GitHub Desktop.
Save marcossevilla/07e19ae771ad81b2dcd9026cb2f72473 to your computer and use it in GitHub Desktop.
import 'package:dio/dio.dart';
void main() async {
final options = BaseOptions(
baseUrl: 'https://jsonplaceholder.typicode.com/',
connectTimeout: 5000,
receiveTimeout: 3000,
responseType: ResponseType.json,
);
final dio = Dio(options);
final response = await dio.get('todos/1');
print('Response statusCode: ${response.statusCode}');
print('Response body: ${response.data}');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment