I'm building an app with Flutter and a backend server with a Python Flask server..
The data returned from the backend server is in the following format:
(('helloworld',), ('hello',))
I want to extract helloworld and hello from this data.
However, sometimes there is only one piece of data, sometimes two, and sometimes more.
How can I extract data? Below is my code.
import 'package:flutter/material.dart';
import 'package:dio/dio.dart';
import 'dart:core';
class messageview extends StatefulWidget {
@override
mymessageview createState() => mymessageview();
}
class mymessageview extends State<messageview> {
void _loadmydata() async {
final dio = Dio();
final response = await dio.get('http://127.0.0.1:3000/mymessage');
//Here we need code to extract data.
}
@override
void initState() {
super.initState();
_loadmydata();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text("My Messasge View")
),
);
}
}
If you know a way to solve this problem, please let me know how to solve it.
You can modify your _loadmydata() function to extract the data: