Flutter GET POST :
Flutter GET POST each the community calls are applied at the same time as the use of dio library is defined on this a part of the educational.
It could sound very attention-grabbing to execute each immediately we’ve got obviously defined this situation thru a video instructional.
pubspec.yaml:
Upload dio library on your pubspec report
dependencies: flutter: sdk: flutter dio: ^4.0.6
primary.dart :
We can be executing each GET and POST implementations for a given api’s and can fetch the reaction immediately the use of array listing.
Can fetch the knowledge in step with the positions.
Offering the whole code for api implementation.
import 'bundle:dio/dio.dart'; import 'bundle:flutter/subject matter.dart'; void primary(){ runApp(const MyApp()); } elegance MyApp extends StatelessWidget { const MyApp({Key? key}) : tremendous(key: key); @override Widget construct(BuildContext context) { go back MaterialApp( house: Scaffold( frame: Heart( kid: Column( mainAxisAlignment: MainAxisAlignment.heart, kids: [ TextButton(onPressed: (){ fetchData(); }, child: const Text("Get / Post Data")) ], ), ), ), ); } } void fetchData() async{ var dio = Dio(); var reaction = look forward to Long run.wait([ dio.get('https://jsonplaceholder.typicode.com/posts/1'), dio.post('https://jsonplaceholder.typicode.com/posts') ]); print(reaction.period); print(reaction[0].information); print(reaction[1].information); }