-
-
Save marcossevilla/07e19ae771ad81b2dcd9026cb2f72473 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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