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

Exception: Unable to parse number with data: 0% #11

Open
Kahoulam opened this issue Nov 27, 2023 · 0 comments
Open

Exception: Unable to parse number with data: 0% #11

Kahoulam opened this issue Nov 27, 2023 · 0 comments

Comments

@Kahoulam
Copy link

Steps to reproduce

  1. Create a new project
  2. Add tokens.json file
  3. Execute the command dart run build_runner build

Expected results

Correctly generate tokens.dart file

Actual results

An error occurred:

Exception: Unable to parse number with data: 0%

Version

design_tokens_builder: ^0.2.0+1

Code sample

tokens.json
{
  "global": {
    "letterSpacing": {
      "0": {
        "value": "-0.25",
        "type": "letterSpacing"
      },
      "1": {
        "value": "0%",
        "type": "letterSpacing"
      },
      "2": {
        "value": "0.15",
        "type": "letterSpacing"
      },
      "3": {
        "value": "0.1",
        "type": "letterSpacing"
      },
      "4": {
        "value": "0.5",
        "type": "letterSpacing"
      },
      "5": {
        "value": "0.25",
        "type": "letterSpacing"
      }
    }
  },
  "$themes": [],
  "$metadata": {
    "tokenSetOrder": [
      "global"
    ]
  }
}

Logs

Console logs
[INFO] Generating build script completed, took 240ms
[INFO] Reading cached asset graph completed, took 66ms
[INFO] Checking for updates since last build completed, took 846ms
[WARNING] design_tokens_builder|lib/design_tokens_builder.dart was not found in the asset graph, incremental builds will not work.
 This probably means you don't have your dependencies specified fully in your pubspec.yaml.
[WARNING] Invalidating asset graph due to build script update!
[INFO] Cleaning up outputs from previous builds. completed, took 1ms
[INFO] Generating build script completed, took 42ms
[WARNING] Invalidated precompiled build script due to missing asset graph.
[INFO] Precompiling build script... completed, took 607ms
[WARNING] design_tokens_builder|lib/design_tokens_builder.dart was not found in the asset graph, incremental builds will not work.
 This probably means you don't have your dependencies specified fully in your pubspec.yaml.
[INFO] Building new asset graph completed, took 924ms
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms
[SEVERE] design_tokens_builder on lib/$lib$:

Exception: Unable to parse number with data: 0%
[INFO] Running build completed, took 40ms
[INFO] Caching finalized dependency graph completed, took 42ms
[SEVERE] Failed after 88ms

Flutter Doctor output

Doctor output
  [✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-TW)
  [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
  [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
  [✓] Chrome - develop for the web
  [✓] Android Studio (version 2022.3)
  [✓] VS Code (version 1.84.0)
  [✓] Connected device (1 available)
  [✓] Network resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant