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

fix: Error on empty action json #105

Open
divyanshub024 opened this issue Jan 14, 2025 · 4 comments
Open

fix: Error on empty action json #105

divyanshub024 opened this issue Jan 14, 2025 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@divyanshub024
Copy link
Member

Description

Getting error type '_Map<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>?' in type cast<…> when passed an empty action json.

{
              "type": "textButton",
              "onPressed": {},
              "child": {
                "type": "text",
                "data": "Forgot password?",
                "style": {
                  "fontSize": 15,
                  "fontWeight": "w500",
                  "color": "#4745B4"
                }
              }
            }

Expected Behavior

{} Empty JSON should act like a null action on call.
Add any other context about the problem here.

@divyanshub024 divyanshub024 added the bug Something isn't working label Jan 14, 2025
@divyanshub024 divyanshub024 added this to the v0.9 milestone Jan 14, 2025
@divyanshub024 divyanshub024 self-assigned this Jan 21, 2025
@Kimhooo
Copy link

Kimhooo commented Feb 13, 2025

Bro, are you making changes to the code? I tried running it based on the example code, but there are a lot of files that it says it can't find.I'm currently using version 0.10.0

@divyanshub024
Copy link
Member Author

divyanshub024 commented Feb 13, 2025

Hey @Kimhooo !! Can you please share the logs?

@divyanshub024 divyanshub024 modified the milestones: v0.9, v1.0 Feb 13, 2025
@Kimhooo
Copy link

Kimhooo commented Feb 13, 2025

`../stac-0.10.0/lib/src/parsers/stac_form/stac_form.g.dart:26:20: Error: Member not found: 'onUnfocus'.
AutovalidateMode.onUnfocus: 'onUnfocus',
^^^^^^^^^
../stac-0.10.0/lib/src/parsers/stac_text_form_field/stac_text_form_field.g.dart:206:20: Error: Member not found: 'onUnfocus'.
AutovalidateMode.onUnfocus: 'onUnfocus',
^^^^^^^^^
../stac-0.10.0/lib/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart:40:23: Error: The getter 'WidgetStateProperty' isn't defined for the class 'StacNavigationBarThemeData'.

  • 'StacNavigationBarThemeData' is from 'package:stac/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart' ('../stac-0.10.0/lib/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    labelTextStyle: WidgetStateProperty.all(labelTextStyle?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart:41:18: Error: The getter 'WidgetStateProperty' isn't defined for the class 'StacNavigationBarThemeData'.
  • 'StacNavigationBarThemeData' is from 'package:stac/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart' ('../stac-0.10.0/lib/src/parsers/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    iconTheme: WidgetStateProperty.all(iconTheme?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart:42:21: Error: The getter 'WidgetStateProperty' isn't defined for the class 'StacTabBarThemeData'.
  • 'StacTabBarThemeData' is from 'package:stac/src/parsers/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart' ('../stac-0.10.0/lib/src/parsers/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(overlayColor.toColor(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/utils/color_utils.dart:72:44: Error: The getter 'surfaceContainerHighest' isn't defined for the class 'ColorScheme'.
  • 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('../fvm/versions/3.19.5/packages/flutter/lib/src/material/color_scheme.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'surfaceContainerHighest'.
    return Theme.of(context).colorScheme.surfaceContainerHighest;
    ^^^^^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart:19:16: Error: The method 'CarouselView' isn't defined for the class 'StacCarouselViewParser'.
  • 'StacCarouselViewParser' is from 'package:stac/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'CarouselView'.
    return CarouselView(
    ^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart:24:15: Error: The getter 'WidgetStateProperty' isn't defined for the class 'StacCarouselViewParser'.
  • 'StacCarouselViewParser' is from 'package:stac/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    WidgetStateProperty.all(model.overlayColor.toColor(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart:38:16: Error: The getter 'CarouselView' isn't defined for the class 'StacCarouselViewParser'.
  • 'StacCarouselViewParser' is from 'package:stac/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'CarouselView'.
    return CarouselView.weighted(
    ^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart:43:15: Error: The getter 'WidgetStateProperty' isn't defined for the class 'StacCarouselViewParser'.
  • 'StacCarouselViewParser' is from 'package:stac/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_carousel_view/stac_carousel_view_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    WidgetStateProperty.all(model.overlayColor.toColor(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_check_box/stac_check_box_parser.dart:63:11: Error: The getter 'WidgetStateProperty' isn't defined for the class '_StacCheckBoxState'.
  • '_StacCheckBoxState' is from 'package:stac/src/parsers/stac_check_box/stac_check_box_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_check_box/stac_check_box_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    WidgetStateProperty.all(widget.model.fillColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_check_box/stac_check_box_parser.dart:68:11: Error: The getter 'WidgetStateProperty' isn't defined for the class '_StacCheckBoxState'.
  • '_StacCheckBoxState' is from 'package:stac/src/parsers/stac_check_box/stac_check_box_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_check_box/stac_check_box_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    WidgetStateProperty.all(widget.model.overlayColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_chip/stac_chip_parser.dart:41:7: Error: No named parameter with the name 'avatarBoxConstraints'.
    avatarBoxConstraints: model.avatarBoxConstraints?.parse,
    ^^^^^^^^^^^^^^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/material/chip.dart:565:9: Context: Found this candidate, but the arguments don't match.
    const Chip({
    ^^^^
    ../stac-0.10.0/lib/src/parsers/stac_column/stac_column_parser.dart:24:7: Error: No named parameter with the name 'spacing'.
    spacing: model.spacing,
    ^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/widgets/basic.dart:5155:9: Context: Found this candidate, but the arguments don't match.
    const Column({
    ^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart:70:11: Error: No named parameter with the name 'mouseCursor'.
    mouseCursor: model.mouseCursor?.value,
    ^^^^^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/cupertino/radio.dart:70:9: Context: Found this candidate, but the arguments don't match.
    const CupertinoRadio({
    ^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart:101:22: Error: The getter 'WidgetStateProperty' isn't defined for the class '_RadioWidget'.
  • '_RadioWidget' is from 'package:stac/src/parsers/stac_radio/stac_radio_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    fillColor: WidgetStateProperty.all(model.fillColor?.toColor(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart:104:25: Error: The getter 'WidgetStateProperty' isn't defined for the class '_RadioWidget'.
  • '_RadioWidget' is from 'package:stac/src/parsers/stac_radio/stac_radio_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart:135:22: Error: The getter 'WidgetStateProperty' isn't defined for the class '_RadioWidget'.
  • '_RadioWidget' is from 'package:stac/src/parsers/stac_radio/stac_radio_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    fillColor: WidgetStateProperty.all(model.fillColor?.toColor(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart:138:25: Error: The getter 'WidgetStateProperty' isn't defined for the class '_RadioWidget'.
  • '_RadioWidget' is from 'package:stac/src/parsers/stac_radio/stac_radio_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_radio/stac_radio_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_row/stac_row_parser.dart:24:7: Error: No named parameter with the name 'spacing'.
    spacing: model.spacing,
    ^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/widgets/basic.dart:4964:9: Context: Found this candidate, but the arguments don't match.
    const Row({
    ^^^
    ../stac-0.10.0/lib/src/parsers/stac_slider/stac_slider_parser.dart:102:21: Error: The getter 'WidgetStateProperty' isn't defined for the class '__StacSliderState'.
  • '__StacSliderState' is from 'package:stac/src/parsers/stac_slider/stac_slider_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_slider/stac_slider_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_slider/stac_slider_parser.dart:131:21: Error: The getter 'WidgetStateProperty' isn't defined for the class '__StacSliderState'.
  • '__StacSliderState' is from 'package:stac/src/parsers/stac_slider/stac_slider_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_slider/stac_slider_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:79:7: Error: No named parameter with the name 'activeTrackColor'.
    activeTrackColor: model.activeColor.toColor(context),
    ^^^^^^^^^^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/cupertino/switch.dart:68:9: Context: Found this candidate, but the arguments don't match.
    const CupertinoSwitch({
    ^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:106:19: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    thumbColor: WidgetStateProperty.all(model.thumbColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:107:19: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackColor: WidgetStateProperty.all(model.trackColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:108:26: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackOutlineColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:111:26: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackOutlineWidth: WidgetStateProperty.all(model.trackOutlineWidth),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:112:18: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    thumbIcon: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:118:21: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:141:19: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    thumbColor: WidgetStateProperty.all(model.thumbColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:142:19: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackColor: WidgetStateProperty.all(model.trackColor?.parse(context)),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:143:26: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackOutlineColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:146:26: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    trackOutlineWidth: WidgetStateProperty.all(model.trackOutlineWidth),
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:147:18: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    thumbIcon: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart:154:21: Error: The getter 'WidgetStateProperty' isn't defined for the class '_SwitchWidgetState'.
  • '_SwitchWidgetState' is from 'package:stac/src/parsers/stac_switch/stac_switch_parser.dart' ('../stac-0.10.0/lib/src/parsers/stac_switch/stac_switch_parser.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'WidgetStateProperty'.
    overlayColor: WidgetStateProperty.all(
    ^^^^^^^^^^^^^^^^^^^
    ../stac-0.10.0/lib/src/parsers/stac_color_scheme/stac_color_scheme.dart:70:7: Error: No named parameter with the name 'surfaceContainerHighest'.
    surfaceContainerHighest: surfaceVariant.toColor(context),
    ^^^^^^^^^^^^^^^^^^^^^^^
    ../fvm/versions/3.19.5/packages/flutter/lib/src/material/color_scheme.dart:87:9: Context: Found this candidate, but the arguments don't match.
    const ColorScheme({
    ^^^^^^^^^^^
    Target kernel_snapshot failed: Exception
    `

It seems like some files haven't been properly adapted or configured. Or is there any version that's stable and usable? I just want to have a try.

@divyanshub024
Copy link
Member Author

Hey @Kimhooo,

This issue seems unrelated to the current thread. Could you please open a new issue for it?

Also, I tested v0.10, and it runs fine on my machine. In the new issue, could you share the output of flutter doctor, the Stac code, the JSON you’re passing, and the full error log you’re encountering? That would help in diagnosing the issue more effectively.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants