it's the first time to write a Flutter code so i am confused, when i tring to get data from API, API working normaly and return a response with data but after that i need to save this data in a list and give it as a variable in another Function but it still empty
Widget number() {
List number_list=[];
get_number().then((value) {number_list=value.values.toList();
print(number_list);// i am giting a list with Values
});
print(number_list); // i am giting an empty list
return ListView(
padding: const EdgeInsets.all(8),
children: buttons(number_list),
);
}