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

Can't encode default theme data. #18

Closed
bimsina opened this issue Oct 27, 2020 · 3 comments
Closed

Can't encode default theme data. #18

bimsina opened this issue Oct 27, 2020 · 3 comments

Comments

@bimsina
Copy link

bimsina commented Oct 27, 2020

 var encodedTheme = ThemeEncoder.encodeThemeData(ThemeData.light());
 print(encodedTheme);

The above code produces the following exception:

'package:json_theme/src/codec/theme_encoder.dart': Failed assertion: line 3546 pos 12: 'value == null ||
        value is CircleBorder ||
        value is ContinuousRectangleBorder ||
        value is RoundedRectangleBorder': is not true.
@bimsina bimsina changed the title Cant encode default theme data. Can't encode default theme data. Oct 27, 2020
@jpeiffer
Copy link
Contributor

Just to confirm, can you add in the information from flutter doctor?

@bimsina
Copy link
Author

bimsina commented Oct 28, 2020

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale en-NP)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.50.1)
[✓] Connected device (1 available)

• No issues found!

Also, it isn't just with the default themes, the following code also throws the same exception

Map<String, dynamic> themeJson = {};
var theme = ThemeDecoder.decodeThemeData(themeJson);
print(theme);
var encodedTheme = ThemeEncoder.encodeThemeData(theme);
print(encodedTheme);

It successfully decodes the json to a theme, but throws exception on encoding the same theme.

flutter: ThemeData#e9050

════════ Exception caught by gesture ═══════════════════════════════════════════
The following assertion was thrown while handling a gesture:
'package:json_theme/src/codec/theme_encoder.dart': Failed assertion: line 3546 pos 12: 'value == null ||
        value is CircleBorder ||
        value is ContinuousRectangleBorder ||
        value is RoundedRectangleBorder': is not true.

jpeiffer added a commit that referenced this issue Nov 22, 2020
@jpeiffer
Copy link
Contributor

Thanks for the info. I just published a fix with 1.4.2. Closing this, please feel free to add a new issue if you encounter any more problems.

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

2 participants