Skip to content

CompileError: Parsing error: This requires the 'dot-shorthands' language feature to be enabled. at unknown #136

@LittleSheep2Code

Description

@LittleSheep2Code

When running dart_eval compile on a fresh flutter project created with the package template. This error occurred, and I haven't use this language feature in my code.

On flutter version 3.38.6 and dart version 3.10.7

// main.dart
import 'package:flutter/material.dart';

Widget buildEntry() {
  return const MinimalTextWidget();
}

class MinimalTextWidget extends StatefulWidget {
  const MinimalTextWidget({super.key});

  @override
  State<MinimalTextWidget> createState() => _MinimalTextWidgetState();
}

class _MinimalTextWidgetState extends State<MinimalTextWidget> {
  int _tapCount = 0;

  final List<String> _messages = ['Tap me!', 'Hello!', 'Thanks for tapping!'];

  String get _currentMessage => _messages[_tapCount % _messages.length];

  void _handleTap() {
    setState(() {
      _tapCount++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: GestureDetector(
        onTap: _handleTap,
        child: Container(
          padding: const EdgeInsets.all(24),
          decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)),
          child: Text(
            _currentMessage,
            style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
          ),
        ),
      ),
    );
  }
}
# pubspec.yaml
name: miniapp_minimal
description: "A new Flutter package project."
version: 0.0.1
homepage:

environment:
  sdk: ^3.10.7
  flutter: ">=1.17.0"

dependencies:
  flutter:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^6.0.0

Logs

$ dart_eval compile -o minimal.evc
Loading files...
Found binding file: .dart_eval/bindings/flutter_eval.json
Adding packages from package config:
async boolean_selector characters clock collection fake_async flutter_lints leak_tracker leak_tracker_flutter_testing leak_tracker_testing lints matcher material_color_utilities meta path source_span stack_trace stream_channel string_scanner term_glyph test_api vector_math vm_service sky_engine flutter_test
Skipped package flutter because it is bridged.

Compiling package miniapp_minimal...
Unhandled exception:
CompileError: Parsing error: This requires the 'dot-shorthands' language feature to be enabled. at unknown
#0      _parse (package:dart_eval/src/eval/compiler/model/source.dart:118:9)
#1      DartSource.load (package:dart_eval/src/eval/compiler/model/source.dart:37:18)
#2      Compiler.compileSources.<anonymous closure> (package:dart_eval/src/eval/compiler/compiler.dart:202:60)
#3      MappedIterator.moveNext (dart:_internal/iterable.dart:420:20)
#4      new _GrowableList._ofOther (dart:core-patch/growable_array.dart:207:26)
#5      new _GrowableList.of (dart:core-patch/growable_array.dart:156:26)
#6      new List.of (dart:core-patch/array_patch.dart:39:18)
#7      Iterable.toList (dart:core/iterable.dart:517:7)
#8      Compiler.compileSources (package:dart_eval/src/eval/compiler/compiler.dart:204:8)
#9      Compiler.compile (package:dart_eval/src/eval/compiler/compiler.dart:167:12)
#10     cliCompile (package:dart_eval/src/eval/cli/compile.dart:127:34)
#11     main (file:///Users/littlesheep/.pub-cache/hosted/pub.dev/dart_eval-0.8.3/bin/dart_eval.dart:72:5)
#12     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:312:33)
#13     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions