No matter what I try to build to macOS, iOS, or android I get the same errors about "value x can't be returned with type y"
I'm unsure what to try to fix this, thank you for your help
value of type 'TabBarThemeData' can't be returned from a function with return type 'TabBarTheme?'.
The entire output of my terminal follows:
❯ flet build macos
[22:01:43] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.25.1 ✅
Customized app icons and splash images ✅
[22:01:45] Generated app icons ✅
[22:01:51] Packaged Python app ✅
[22:02:13]
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Running pod install... 4.3s
Building macOS application...
macos/Runner/AppDelegate.swift uses the deprecated @NSApplicationMain attribute, updating.
macos/Runner/AppDelegate.swift does not override applicationSupportsSecureRestorableState.
Updating.
.gitignore does not ignore Swift Package Manager build directories, updating.
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-001C55920A33001E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00008103-001C55920A33001E, name:My Mac }
../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:356:28: Error: A
value of type 'TabBarThemeData' can't be returned from a function with return type 'TabBarTheme?'.
- 'TabBarThemeData' is from 'package:flutter/src/material/tab_bar_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
rt').
- 'TabBarTheme' is from 'package:flutter/src/material/tab_bar_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
rt').
return theme.tabBarTheme.copyWith(
^
../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:438:28: Error: A
value of type 'DialogThemeData' can't be returned from a function with return type 'DialogTheme?'.
- 'DialogThemeData' is from 'package:flutter/src/material/dialog_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/dialog_theme.dar
t').
- 'DialogTheme' is from 'package:flutter/src/material/dialog_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/dialog_theme.dar
t').
return theme.dialogTheme.copyWith(
^
../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:482:26: Error: A
value of type 'CardThemeData' can't be returned from a function with return type 'CardTheme?'.
- 'CardThemeData' is from 'package:flutter/src/material/card_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/card_theme.dart'
).
- 'CardTheme' is from 'package:flutter/src/material/card_theme.dart'
('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/card_theme.dart'
).
return theme.cardTheme.copyWith(
^
Target kernel_snapshot_program failed: Exception
Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not
specify any outputs. To address this issue, either add output dependencies to the script phase, or
configure it to run in every build by unchecking "Based on dependency analysis" in the script
phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **
Build process failed
Error building Flet app - see the log of failed command above.
[22:02:26] Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.0, on macOS 15.1.1 24B91 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
I thought it could be an issue with my flutter install so I tried building a normal flutter application and it worked flawlessly I have updated all my dependencies and tried building just the default template.
I assume you updated your Flutter installation to recently updated stable 3.27, right?
At this moment, I believe, there is only 1 way for you to fix this error: downgrade Flutter to previous stable. (3.24.*)
EXPLANATION
Flutter 3.27 introduced breaking change by changing tabBarTheme
's type from TabBarTheme
to TabBarThemeData
.
Your app's dependency, flet
relied on previous behaviour, where tabBarTheme
is TabBarTheme
, hence the broken build. For this to work with Flutter 3.27, flet
must update its code and release new version, and only then you will be able to use Flutter 3.27.
That change have been introduced in this PR: https://github.com/flutter/flutter/pull/156253
Sadly, this breaking change haven't been mentioned in Breaking changes and migration guides by the time or release, so package maintainers had no chance to adapt their code here.
At least, there is migration guide now (couple days after release).