
Flutter Add Symbol :
Flutter add symbol or report is a key facet in few app’s so i want to make it simple for you via this vlog. In our earlier vlogs now we have noticed quite a lot of api request implementations.
Via the usage of this educational you’ll be able to add any report like symbol, audio, video so on..
pubspec.yaml :
Upload the desired dependencies like dio and report picker.
dependencies: flutter: sdk: flutter dio: ^4.0.6 file_picker: ^5.2.2
primary.dart :
Entire code for report add in flutter app.
import 'dart:io'; import 'package deal:file_picker/file_picker.dart'; import 'package deal:dio/dio.dart'; import 'package deal:flutter/subject matter.dart'; import 'package deal:path_provider/path_provider.dart'; void primary() { runApp(MyApp()); } magnificence 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, youngsters: [ TextButton( onPressed: () { uploadFile(); }, child: const Text("Upload File")), ], ), ), ), ); } } Long run uploadFile() async { var dio = Dio(); FilePickerResult? end result = anticipate FilePicker.platform.pickFiles(); if(end result!=null){ Document report = Document(end result.information.unmarried.trail ?? " "); String filename = report.trail.break up('/').ultimate; String filepath = report.trail; FormData information = FormData.fromMap({ 'key': 'your key right here', 'symbol': anticipate MultipartFile.fromFile(filepath, filename: filename) }); var reaction = anticipate dio.submit("https://api.imgbb.com/1/add", information: information, onSendProgress:(int despatched, int general){ print('$despatched, $general'); } ); print(reaction.information); }else { print("Result's null"); } }