for testing purposes, I want to be able to dynamically turn a function name like getUserLocationByUserID(String userID){} into a string 'getUserLocationByUserID' so I can use it elseWhere
So When you have a list of functions and you wanna iterate in them I wish to be able to do something like this
import 'package:flutter/material.dart';
void function1() {}
void function2() {}
void function3() {}
List<Function> functionsList = [function1, function2, function3];
String magicalFunctionThatGetsAStringOutOfAFunctionName(Function function) {
String functionNameAsAString = ''; // magical code here <----------------------------------------------
return functionNameAsAString;
}
class FunctionTester extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView.builder(
itemCount: functionsList.length,
itemBuilder: (context, index) => GestureDetector(
onTap: functionsList[index],
child: Container(
width: 300,
height: 300,
child: Text(
magicalFunctionThatGetsAStringOutOfAFunctionName(functionsList[index]),
maxLines: 1,
style: TextStyle(
fontSize: 10,
),
),
),
),
),
);
}
}