getFunctionReturnType static method

String getFunctionReturnType(
  1. dynamic function
)

Implementation

static String getFunctionReturnType(dynamic function) {
  final text = function.toString();
  final splitted = text.split(" ");
  final count = splitted.length;
  int index = -1;
  for (int i = 0; i < count; i++) {
    final item = splitted[i];
    if (item == "=>") {
      index = i;
      break;
    }
  }
  if (index >= 0 && index + 1 < count) return splitted[index + 1];
  return "";
}