zacktu (1) [Avatar] Offline
#1
I am working through the DartExpense code in chapter 10. I think that I've eliminated all errors due to the conversion to version 1. Chapter 10 is about building a web app, but the execution error is in some of the support code.

Here are the error statements:

Exception: type '() => dynamic' is not a subtype of type 'GetExpenses' of 'dataSource'.
loadExpenses (http://127.0.0.1:3030/DartInAction/chap-10/DartExpense/data_access.dart:12:46)
MockData.MockData (http://127.0.0.1:3030/DartInAction/chap-10/DartExpense/mocks/mock_data.dart:14:35)
main (http://127.0.0.1:3030/DartInAction/chap-10/DartExpense/DartExpense.dart:21:24)

The call sequence is
DartExpense.dart: var dataSource = new MockData();

mock_data.dart: var tmpExpenses = loadExpenses(getMockExpenses); // passing in the function in library scope

data_access.dart: Collection<Expense> loadExpenses(GetExpenses dataSource) {

The use of Collection as a class is flagged in the declaration above. I changed Collection to List, but I still get the same three error messages.

What to do now?