You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
I/flutter ( 912): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 912): The following assertion was thrown during a scheduler callback:
I/flutter ( 912): setState() called after dispose(): BaseChartState#d9d5b(lifecycle state: defunct, not
I/flutter ( 912): mounted, tickers: tracking 0 tickers)
I/flutter ( 912): This error happens if you call setState() on a State object for a widget that no longer appears in
I/flutter ( 912): the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
I/flutter ( 912): can occur when code calls setState() from a timer or an animation callback. The preferred solution
I/flutter ( 912): is to cancel the timer or stop listening to the animation in the dispose() callback. Another
I/flutter ( 912): solution is to check the "mounted" property of this object before calling setState() to ensure the
I/flutter ( 912): object is still in the tree.
I/flutter ( 912): This error might indicate a memory leak if setState() is being called because another object is
I/flutter ( 912): retaining a reference to this State object after it has been removed from the tree. To avoid memory
I/flutter ( 912): leaks, consider breaking the reference to this object during dispose().
I/flutter ( 912):
I/flutter ( 912): When the exception was thrown, this was the stack:
I/flutter ( 912): #0 State.setState. (package:flutter/src/widgets/framework.dart:1095:9)
I/flutter ( 912): #1 State.setState (package:flutter/src/widgets/framework.dart:1121:6)
I/flutter ( 912): #2 BaseChartState.requestRebuild (package:charts_flutter/src/base_chart_state.dart:71:5)
I/flutter ( 912): #3 ChartContainerRenderObject.requestRebuild.doRebuild (package:charts_flutter/src/chart_container.dart:268:19)
I/flutter ( 912): #4 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter ( 912): #5 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:936:9)
I/flutter ( 912): #6 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:840:5)
I/flutter ( 912): #10 _invoke (dart:ui/hooks.dart:209:10)
I/flutter ( 912): #11 _drawFrame (dart:ui/hooks.dart:168:3)
I/flutter ( 912): (elided 3 frames from package dart:async)
I/flutter ( 912): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 912): Another exception was thrown: setState() called after dispose(): BaseChartState#73a56(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
I/flutter ( 912): Another exception was thrown: setState() called after dispose(): BaseChartState#e7d27(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
// CODE:
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:main/const.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
I have a similar issue with grouped bar charts plotted within a TabBarView, commenting out behaviors prevented the exception errors, but now I have no legend.
Say you have four tabs, if you jump a tab, i.e. from the first tab to the third tab, an exception is shown, but not if you sequential tap each tab, i.e. first tab, second tab, third tab, forth tab, third tab etc..
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.33.1)
[✓] Connected device (1 available)
I/flutter ( 912): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 912): The following assertion was thrown during a scheduler callback:
I/flutter ( 912): setState() called after dispose(): BaseChartState#d9d5b(lifecycle state: defunct, not
I/flutter ( 912): mounted, tickers: tracking 0 tickers)
I/flutter ( 912): This error happens if you call setState() on a State object for a widget that no longer appears in
I/flutter ( 912): the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
I/flutter ( 912): can occur when code calls setState() from a timer or an animation callback. The preferred solution
I/flutter ( 912): is to cancel the timer or stop listening to the animation in the dispose() callback. Another
I/flutter ( 912): solution is to check the "mounted" property of this object before calling setState() to ensure the
I/flutter ( 912): object is still in the tree.
I/flutter ( 912): This error might indicate a memory leak if setState() is being called because another object is
I/flutter ( 912): retaining a reference to this State object after it has been removed from the tree. To avoid memory
I/flutter ( 912): leaks, consider breaking the reference to this object during dispose().
I/flutter ( 912):
I/flutter ( 912): When the exception was thrown, this was the stack:
I/flutter ( 912): #0 State.setState. (package:flutter/src/widgets/framework.dart:1095:9)
I/flutter ( 912): #1 State.setState (package:flutter/src/widgets/framework.dart:1121:6)
I/flutter ( 912): #2 BaseChartState.requestRebuild (package:charts_flutter/src/base_chart_state.dart:71:5)
I/flutter ( 912): #3 ChartContainerRenderObject.requestRebuild.doRebuild (package:charts_flutter/src/chart_container.dart:268:19)
I/flutter ( 912): #4 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter ( 912): #5 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:936:9)
I/flutter ( 912): #6 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:840:5)
I/flutter ( 912): #10 _invoke (dart:ui/hooks.dart:209:10)
I/flutter ( 912): #11 _drawFrame (dart:ui/hooks.dart:168:3)
I/flutter ( 912): (elided 3 frames from package dart:async)
I/flutter ( 912): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 912): Another exception was thrown: setState() called after dispose(): BaseChartState#73a56(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
I/flutter ( 912): Another exception was thrown: setState() called after dispose(): BaseChartState#e7d27(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
// CODE:
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:main/const.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class ScreenHomeAnimatedCharts extends StatefulWidget {
@OverRide
_ScreenHomeAnimatedChartsState createState() =>
_ScreenHomeAnimatedChartsState();
}
class _ScreenHomeAnimatedChartsState extends State {
List<charts.Series<Pollution, String>> seriesBarData;
List<charts.Series<Task, String>> seriesPieData;
List<charts.Series<Sales, int>> seriesLineData;
@OverRide
void initState() {
super.initState();
seriesBarData = List<charts.Series<Pollution, String>>();
seriesPieData = List<charts.Series<Task, String>>();
seriesLineData = List<charts.Series<Sales, int>>();
generateData();
}
generateData() {
List barData1 = [
Pollution(year: 1980, place: 'USA', quantity: 20),
Pollution(year: 1980, place: 'Asia', quantity: 40),
Pollution(year: 1980, place: 'Europe', quantity: 10),
];
List barData2 = [
Pollution(year: 1980, place: 'USA', quantity: 50),
Pollution(year: 1980, place: 'Asia', quantity: 30),
Pollution(year: 1980, place: 'Europe', quantity: 40),
];
List barData3 = [
Pollution(year: 1980, place: 'USA', quantity: 70),
Pollution(year: 1980, place: 'Asia', quantity: 70),
Pollution(year: 1980, place: 'Europe', quantity: 100),
];
}
@OverRide
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
backgroundColor: Const.colorMain,
title: Text('Charts'),
centerTitle: true,
elevation: 0,
bottom: TabBar(
indicatorColor: Colors.white,
tabs: [
Tab(icon: Icon(FontAwesomeIcons.solidChartBar)),
Tab(icon: Icon(FontAwesomeIcons.chartPie)),
Tab(icon: Icon(FontAwesomeIcons.chartLine)),
],
),
),
body: TabBarView(
children: [
/* BAR CHART */
Container(
child: Center(
child: Column(
children: [
Container(
alignment: Alignment.bottomLeft,
padding: EdgeInsets.all(20),
child: Text(
'Bar Chart\nPollution by world region',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: Container(
padding: EdgeInsets.all(10),
child: charts.BarChart(
seriesBarData,
// barGroupingType: charts.BarGroupingType.stacked,
// barGroupingType: charts.BarGroupingType.grouped,
animate: true,
animationDuration: Duration(seconds: 1),
),
),
)
],
),
),
),
}
}
class Task {
String task;
double taskValue;
Color colorValue;
Task({this.task, this.taskValue, this.colorValue});
}
class Pollution {
String place;
int year, quantity;
Pollution({this.place, this.year, this.quantity});
}
class Sales {
int year;
int value;
Sales({this.year, this.value});
}
The text was updated successfully, but these errors were encountered: