5
在Dart中,是否有可能具有定義好的簽名的函數列表?我正在尋找像在Dart中定義簽名的函數列表
List<(int, int) -> int> listOfFunctions;
這當然是錯誤的。
我可以做
List<Function> listOfFunctions;
但我不知道簽名。
感謝您的任何提示。
在Dart中,是否有可能具有定義好的簽名的函數列表?我正在尋找像在Dart中定義簽名的函數列表
List<(int, int) -> int> listOfFunctions;
這當然是錯誤的。
我可以做
List<Function> listOfFunctions;
但我不知道簽名。
感謝您的任何提示。
只要創建一個typedef爲你的函數
typedef int MyFunction(int a, int b);
List<MyFunction> listOfFunctions;