Graphql-flutter: Compile error on Flutter 1.5.5

Created on 24 Apr 2019  路  6Comments  路  Source: zino-app/graphql-flutter

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:

  1. flutter channel dev
  2. flutter upgrade
  3. flutter run or flutter test
  4. See error

Expected behavior
The project needs to run without compile errors.

Desktop:

  • OS: macOS High Sierra
  • Version 10.13.6

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,
});

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings