figma2flutter
figma2flutter copied to clipboard
[BUG] type '_Map<String, dynamic>' is not a subtype of type 'String?' in type cast
:information_source: Info
Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-arm64, locale pt-BR)
Version: figma2flutter: ^0.3.0-alpha
:speech_balloon: Description
After executing the command this error occurs figma2flutter --input ./tokens --output ./lib/tokens/
Loading $metadata, $themes and design token files from ./tokens
Unhandled exception:
type '_Map<String, dynamic>' is not a subtype of type 'String?' in type cast
#0 TokenParser.findTokens (package:figma2flutter/token_parser.dart:106:59)
#1 TokenParser.findTokens (package:figma2flutter/token_parser.dart:106:11)
#2 TokenParser.parse (package:figma2flutter/token_parser.dart:41:22)
#3 _parseInputJson (file:///Users/weldonsouza/.pub-cache/hosted/pub.dev/figma2flutter-0.3.0-alpha/bin/figma2flutter.dart:165:49)
#4 _parseFromFileSet (file:///Users/weldonsouza/.pub-cache/hosted/pub.dev/figma2flutter-0.3.0-alpha/bin/figma2flutter.dart:144:18)
#5 main (file:///Users/weldonsouza/.pub-cache/hosted/pub.dev/figma2flutter-0.3.0-alpha/bin/figma2flutter.dart:83:16)
**Enter a description of your problem here.
Any logs, error and assets you have that can help to find this bug.
:scroll: tokens file you tried to import
It may be that a certain way of exporting or new options are not supported. When providing a json file we can hunt down problems more quickly
Based on the $themes.json file I'm guessing the following:
You have multiple token group values in the same theme file where the themes for a particular group are all symmetrical while the groups don't have the same tokens at each other.
- primitives
- color-scheme
- breakpoint
- theme
figma2flutter does not support disparate groups of tokens. figma2flutter operates under the assumption that all of the themes are equivalent and that they can be swapped out for each other in the way that light and dark often are. It generates an interface for all of the tokens and then concreate implementations for all of the interface entries for each of themes. This means that it expects all of the themes to have the same tokens.
Someone would have to add group support where different groups could be generated in the same run.
Good afternoon! Thank you very much for the explanation and I appreciate the answer, unfortunately I don't have much knowledge of Figma and regarding this json I ended up having to do the manipulation by hand.
Em dom., 9 de fev. de 2025, 4:48 PM, Joe Freeman @.***> escreveu:
Based on the $themes.json file I'm guessing the following:
You have multiple token group values in the same theme file where the themes for a particular group are all symmetrical while the groups don't have the same tokens at each other.
- primitives
- color-scheme
- breakpoint
- theme
figma2flutter does not support disparate groups of tokens. figma2flutter operates under the assumption that all of the themes are equivalent and that they can be swapped out for each other in the way that light and dark often are. It generates an interface for all of the tokens and then concreate implementations for all of the interface entries for each of themes. This means that it expects all of the themes to have the same tokens.
Someone would have to add group support where different groups could be generated in the same run.
— Reply to this email directly, view it on GitHub https://github.com/mark-nicepants/figma2flutter/issues/43#issuecomment-2646557437, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMIBY2R7XWT6NXKNUF45QXD2O6WJXAVCNFSM6AAAAABVXCSAHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBWGU2TONBTG4 . You are receiving this because you authored the thread.Message ID: @.***>
Any chance you could provide the rest of the json files for this use case? This report only includes the $theme and $metadata
Closing issue as no longer an issue for the requester
This was the file shared with me, I hope it helps
Em seg., 10 de fev. de 2025 às 09:15, Joe Freeman @.***> escreveu:
Any chance you could provide the rest of the json files for this use case? This report only includes the $theme and $metadata
— Reply to this email directly, view it on GitHub https://github.com/mark-nicepants/figma2flutter/issues/43#issuecomment-2647815796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMIBY2UYR3NAUWMXSDVT3C32PCJ6VAVCNFSM6AAAAABVXCSAHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBXHAYTKNZZGY . You are receiving this because you authored the thread.Message ID: @.***>
I could be missing my morning coffee but I don't see the attachment.