I already have Firebase Cloud Functions in JavaScript for an app. But I'm trying to arrange it so that I can write them in Dart, which will be automatically converted into JavaScript, following this instruction: https://pub.dev/documentation/firebase_functions_interop/latest/
When I come to the point of:
dart run build_runner build --output=build
(yes, I changed "pub" to "dart", since "pub" wasn't a defined operable or command, and "dart pub" etc was deprecated, according to the response I got... Could this be the root of the problem?),
I get this error:
Building package executable...
Failed to build build_runner:build_runner:
../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/front_end-0.1.4+2/lib/src/fasta/crash.dart:96:45: Error: Member not found: 'JSON'.
..headers.contentType = ContentType.JSON
^^^^
and no index.dart.js
file is created.
This is what my pubspec.yaml looks like:
name: functions
version: 1.0.0
environment:
sdk: '>=2.0.0-dev <3.0.0'
# sdk: '>=2.12.0 <3.0.0'
# sdk: '>=2.8.0 <3.0.0'
dependencies:
firebase_functions_interop: 1.0.0
# firebase_functions_interop: ^1.0.2
dev_dependencies:
build_runner: 1.0.0
# build_runner: ^1.9.9
# build_runner: ^2.0.3
# build_runner: ^1.9.0
build_node_compilers: 0.2.0
# build_node_compilers: ^0.3.1
I have tried to upgrade everything, but since build_node_compilers
seems to be quite an abandonded package (last update was 23 months ago), I can't use the latest version of build_runner
...
I've done a number of flutter clean, flutter pub get (turned out to be a bad idea, since this is a Dart project), dart pub get, dart pub upgrade, dart pub upgrade --major-versions, firebase @latest etc... but this error won't go away.
Please help! I don't know where to even start looking...
from "Error: Member not found: 'JSON'", when trying to write Firebase Cloud Functions in Dart
No comments:
Post a Comment