Skip to content

[syncfusion_flutter_charts] NoSuchMethodError was thrown while notifying listeners for AnimationController #257

@mitulvaghamshi

Description

@mitulvaghamshi

════════ Exception caught by animation library ═════════════════════════════════
The following NoSuchMethodError was thrown while notifying listeners for AnimationController:
The method '-' was called on null.
Receiver: null
Tried calling: -(null)

When the exception was thrown, this was the stack
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1 _CartesianAxisRendererState._animateAxis package:syncfusion_flutter_charts/…/axis/axis_renderer.dart:230
#2 _CartesianAxisRendererState._repaintAxisElements package:syncfusion_flutter_charts/…/axis/axis_renderer.dart:281
#3 AnimationLocalListenersMixin.notifyListeners package:flutter/…/animation/listener_helpers.dart:136
#4 AnimationController.value= package:flutter/…/animation/animation_controller.dart:366
...
The AnimationController notifying listeners was: AnimationController#64e3d(⏮ 0.000; paused)
════════════════════════════════════════════════════════════════════════════════

// my code
child: SfCartesianChart(
    primaryXAxis: NumericAxis(
        labelFormat: '{value} s',
        visibleMaximum: _isLongList ? 50 : 5, // error on altering max visibles
        // visibleMaximum: 50, // works fine with constant value.
        majorGridLines: const MajorGridLines(width: 0),
    ),
    ...
// axis_renderer.dart:230
} else {
    axisRenderer._visibleMinimum =
        oldAxisRenderer._axis.visibleMinimum -
            (oldAxisRenderer._axis.visibleMinimum - // error cause, The method '-' was called on null.
                    axisRenderer._axis.visibleMinimum) *
                animationFactor;
    axisRenderer._visibleMaximum =
        oldAxisRenderer._axis.visibleMaximum -
            (oldAxisRenderer._axis.visibleMaximum -
                    axisRenderer._axis.visibleMaximum) *
                animationFactor;
}
environment:
  sdk: '>=2.13.0 <3.0.0'

dependencies:
  syncfusion_flutter_charts: ^19.1.56

My app is to display data lists with different length including range (50 - 10000) elements displayed on X-Axis,
for small lists I chose 5 max visible on X-Axis, 50 for long ones.
The error occurs while transitioning from small to large data set, that requires X-Axis to be animated to match the visible points.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions