Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch errors in json_theme package for CardTheme, DialogTheme, and TabBarTheme #120

Open
mr-september opened this issue Jan 7, 2025 · 0 comments

Comments

@mr-september
Copy link

mr-september commented Jan 7, 2025

Description

Building the app fails due to type mismatches in the json_theme package. The encoder is unable to handle the updated Theme types from Flutter.

Error Details

Three type mismatch errors occur in theme_encoder.dart:

  1. CardThemeData cannot be assigned to CardTheme?
  2. DialogThemeData cannot be assigned to DialogTheme?
  3. TabBarThemeData cannot be assigned to TabBarTheme?

Environment

  • Flutter version: 3.27.0 (stable channel)
  • Flutter framework: revision 8495dee1fd (2024-12-10 14:23:39 -0800)
  • Engine: revision 83bacfc525
  • Dart: 3.6.0
  • DevTools: 2.40.2
  • json_theme package version: 20570ff
  • Operating System: Windows 11
  • Development Environment: Visual Studio Code

Error Log

/C:/Users/<USERNAME>/AppData/Local/Pub/Cache/git/json_theme-f08555bb50b7e55d49fc292bf873ed0573b7d986/json_theme/lib/src/codec/theme_encoder.dart:7089:44: Error: The argument type 'CardThemeData' can't be assigned to the parameter type 'CardTheme?'.     
 - 'CardThemeData' is from 'package:flutter/src/material/card_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/card_theme.dart').
 - 'CardTheme' is from 'package:flutter/src/material/card_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/card_theme.dart').
        'cardTheme': encodeCardTheme(value.cardTheme),
                                           ^
/C:/Users/<USERNAME>/AppData/Local/Pub/Cache/git/json_theme-f08555bb50b7e55d49fc292bf873ed0573b7d986/json_theme/lib/src/codec/theme_encoder.dart:7100:48: Error: The argument type 'DialogThemeData' can't be assigned to the parameter type 'DialogTheme?'. 
 - 'DialogThemeData' is from 'package:flutter/src/material/dialog_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/dialog_theme.dart').
 - 'DialogTheme' is from 'package:flutter/src/material/dialog_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/dialog_theme.dart').
        'dialogTheme': encodeDialogTheme(value.dialogTheme),
                                               ^
/C:/Users/<USERNAME>/AppData/Local/Pub/Cache/git/json_theme-f08555bb50b7e55d49fc292bf873ed0573b7d986/json_theme/lib/src/codec/theme_encoder.dart:7162:48: Error: The argument type 'TabBarThemeData' can't be assigned to the parameter type 'TabBarTheme?'. 
 - 'TabBarThemeData' is from 'package:flutter/src/material/tab_bar_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/tab_bar_theme.dart').
 - 'TabBarTheme' is from 'package:flutter/src/material/tab_bar_theme.dart' ('/E:/flutter/packages/flutter/lib/src/material/tab_bar_theme.dart').
        'tabBarTheme': encodeTabBarTheme(value.tabBarTheme),
                                               ^
Target kernel_snapshot_program failed: Exception


FAILURE: Build failed with an exception.

* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1685

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Steps to Reproduce

git clone https://github.com/Mantano/iridium.git
cd iridium/demo-app
flutter devices <-- Pick a device id in the list (in the 2nd column)
flutter run -d <device_id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant