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

datasets is null after performing 'Hot reload' in RadarChart() #920

Closed
arrmani88 opened this issue Mar 3, 2022 · 1 comment
Closed

datasets is null after performing 'Hot reload' in RadarChart() #920

arrmani88 opened this issue Mar 3, 2022 · 1 comment

Comments

@arrmani88
Copy link

arrmani88 commented Mar 3, 2022

After executing the code below, the execution finishes successfully, but after performing a "Hot reload", I got this Error:

======== Exception caught by widgets library =======================================================
The following assertion was thrown building RadarChart(duration: 150ms, dirty, state: _RadarChartState#c86be(ticker active)):
'package:fl_chart/src/chart/radar_chart/radar_chart_data.dart': Failed assertion: line 131 pos 16: 'dataSets != null && dataSets.hasEqualDataEntriesLength': is not true.

The relevant error-causing widget was: 
  RadarChart RadarChart:file:///Users/anel-bou/StudioProjects/chartasp/lib/main.dart:21:13
When the exception was thrown, this was the stack: 
#2      new RadarChartData (package:fl_chart/src/chart/radar_chart/radar_chart_data.dart:131:16)
#3      RadarChartData.lerp (package:fl_chart/src/chart/radar_chart/radar_chart_data.dart:194:14)
#4      RadarChartDataTween.lerp (package:fl_chart/src/chart/radar_chart/radar_chart_data.dart:453:43)
#5      Tween.transform (package:flutter/src/animation/tween.dart:327:12)
#6      Animatable.evaluate (package:flutter/src/animation/tween.dart:53:46)
#7      _RadarChartState.build (package:fl_chart/src/chart/radar_chart/radar_chart.dart:40:35)
#8      StatefulElement.build (package:flutter/src/widgets/framework.dart:4870:27)
#9      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4754:15)
#10     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4928:11)
#11     Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#12     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2659:19)
#13     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#14     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#15     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#16     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1081:9)
#17     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:995:5)
#21     _invoke (dart:ui/hooks.dart:151:10)
#22     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#23     _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)
====================================================================================================

After debugging I found that dataSets get a null value somewhere in the package.
Here is my code:

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blueGrey,
      body: RadarChart(
        RadarChartData(
            getTitle: (i) {
              switch (i) {
                case 0: return 'Adaptation & creativity';
                case 1: return 'Algorithms & AI';
                case 2: return 'Company experience';
                case 3: return 'Company experience';
                case 4: return 'Company experience';
              }
              return '';
            },
            dataSets: [
              RadarDataSet(
                  fillColor: null,
                  borderColor: const Color(0xff167676),
                  dataEntries: const [
                    RadarEntry(value: 4.01),
                    RadarEntry(value: 10.63),
                    RadarEntry(value: 10.74),
                    RadarEntry(value: 10.74),
                    RadarEntry(value: 10.74),
                  ]
              ),
            ]
        ),
      ),
    );
  }
}

Flutter version: Flutter (Channel stable, 2.10.0, on Mac OS X 10.14.6 18G9323 darwin-x64, locale en)
fl_chart verison: 0.45.0

@imaNNeo
Copy link
Owner

imaNNeo commented Mar 3, 2022

Hi. I couldn't reproduce it.
When I hot-reload, I don't see any error in my console.

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