Search code examples
androidiosflutterdart

Flutter - Error: 'WidgetStateProperty' is exported from both. After updating to version 3.24.1


Failed to compile after updating Flutter version to version 3.24.1.

Log:

[ ../../../../../../../fvm/versions/3.24.1/packages/flutter/lib/material.dart:196:1: Error: 'WidgetStateProperty' is exported from both 'package:flutter/src/material/material_state.dart' and 'package:flutter/src/widgets/widget_state.dart'. export 'widgets.dart';

../../../../../../../fvm/versions/3.24.1/packages/flutter/lib/src/material/material_state.dart:430:9: Error: The typedef 'WidgetStateProperty' has a reference to itself. typedef WidgetStateProperty = WidgetStateProperty; ^ ../../../../../../../fvm/versions/3.24.1/packages/flutter/lib/src/material/action_chip.dart:13:1: Error: 'WidgetStateProperty' is imported from both 'package:flutter/src/material/material_state.dart' and 'package:flutter/src/widgets/widget_state.dart'. import 'material_state.dart'; ^^^^^^^^^^^^^^^^^^^ ../../../../../../../fvm/versions/3.24.1/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart:11:1: Error: 'WidgetStateProperty' is imported from both 'package:flutter/src/material/material_state.dart' and 'package:flutter/src/widgets/widget_state.dart'. import 'material_state.dart'; ^^^^^^^^^^^^^^^^^^^

Target kernel_snapshot_program failed: Exception

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDevDebug'.

Solution

  • It seems like this is caused by file corruption or inconsistency in the installation of Flutter SDK with FVM in my local. It is currently running successfully, after I uninstalled the flutter fvm version 3.24.1 and reinstalled version 3.24.1, case closed.