Describe the bug
After update flutter to version 1.5.5 the following error is happening on run:
Compiler message:
file:///Users/mateus.gustavo/desenvolvimento/flutter/.pub-cache/hosted/pub.dartlang.org/graphql_flutter-1.0.0+3/lib/src/widgets/subscription.dart:15:3: Error: Function-typed
parameters can't specify 'const', 'final' or 'var' in place of a return type.
Try replacing the keyword with a return type.
final bool loading,
^^^^^
file:///Users/mateus.gustavo/desenvolvimento/flutter/.pub-cache/hosted/pub.dartlang.org/graphql_flutter-1.0.0+3/lib/src/widgets/subscription.dart:16:3: Error: Function-typed
parameters can't specify 'const', 'final' or 'var' in place of a return type.
Try replacing the keyword with a return type.
final T payload,
^^^^^
file:///Users/mateus.gustavo/desenvolvimento/flutter/.pub-cache/hosted/pub.dartlang.org/graphql_flutter-1.0.0+3/lib/src/widgets/subscription.dart:17:3: Error: Function-typed
parameters can't specify 'const', 'final' or 'var' in place of a return type.
Try replacing the keyword with a return type.
final dynamic error,
^^^^^
To Reproduce
Steps to reproduce the behavior:
flutter channel devflutter upgradeflutter run or flutter testExpected behavior
The project needs to run without compile errors.
Desktop:
Additional context
To fix the issue just delete the final keyword from the parameters of the SubscriptionBuilder typedef.
typedef SubscriptionBuilder<T> = Widget Function({
bool loading,
T payload,
dynamic error,
});
I have the same issue
@psyanite Are you too using dart 2.3?
Flutter 1.5.5 and 1.5.4 failed. 1.5.3 worked.
It seems this a bug with dart 2.3. @mateusfsilva has a PR on the same, you can try it out.
merged and should be fixed in 1.0.0+4 (tested on my own depending app)
It might be a regression in dart 2.3, but it might also have been previously-invalid syntax that the compiler didn't throw on. Regardless, the signature was incorrect
Thanks @micimize and @mainawycliffe.