Can´t pass null variable between two pages in flutter











up vote
0
down vote

favorite












I´m trying to navigate between two pages. In second page I need a constructor so i need to declare the variable null in first page and initialize it in the second page.



In main.dart (first page) i have similar to



PostDetailsPage.tag: (context) => PostDetailsPage(new List()),


In the second page (PostDetailsPage) i have this



final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});


When i go to page two return




< List < Series< dynamic, dynamic > > is not a subtype of type < List < Series< dynamic, String>>




So how can i solve? Initializate the value in first page and pass it? Initializate value as null in first page and pass it?



UPDATED



Main.dart class



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';


void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(new List()),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart class



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;


class PostDetailsPage extends StatelessWidget{
static String tag = 'post-details-page';
final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});

/// Creates a [BarChart] with sample data and no transition.
factory PostDetailsPage.withSampleData() {
return new PostDetailsPage(
_createSampleData(),
// Disable animations for image tests.
animate: false,
);
}


@override
Widget build(BuildContext context) {
return new charts.BarChart(
seriesList,
animate: animate,
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}


UPDATED 2: FIXED



Main.dart



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;

class PostDetailsPage extends StatefulWidget {
static String tag = 'post-details-page';

@override
PostDetailsPageState createState() => new PostDetailsPageState();
}

class PostDetailsPageState extends State<PostDetailsPage> {
List<charts.Series> seriesList = ;
bool animate;

void initState() {
super.initState();
seriesList = _createSampleData();
animate = false;
}

@override
Widget build(BuildContext context) {
return new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new charts.BarChart(
seriesList,
animate: animate,
),
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}









share|improve this question
























  • post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
    – Raouf Rahiche
    Nov 9 at 15:52










  • Updated with all code.
    – El Hombre Sin Nombre
    Nov 9 at 16:21










  • you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
    – Raouf Rahiche
    Nov 9 at 16:30










  • Can you put a example?
    – El Hombre Sin Nombre
    Nov 9 at 16:46















up vote
0
down vote

favorite












I´m trying to navigate between two pages. In second page I need a constructor so i need to declare the variable null in first page and initialize it in the second page.



In main.dart (first page) i have similar to



PostDetailsPage.tag: (context) => PostDetailsPage(new List()),


In the second page (PostDetailsPage) i have this



final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});


When i go to page two return




< List < Series< dynamic, dynamic > > is not a subtype of type < List < Series< dynamic, String>>




So how can i solve? Initializate the value in first page and pass it? Initializate value as null in first page and pass it?



UPDATED



Main.dart class



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';


void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(new List()),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart class



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;


class PostDetailsPage extends StatelessWidget{
static String tag = 'post-details-page';
final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});

/// Creates a [BarChart] with sample data and no transition.
factory PostDetailsPage.withSampleData() {
return new PostDetailsPage(
_createSampleData(),
// Disable animations for image tests.
animate: false,
);
}


@override
Widget build(BuildContext context) {
return new charts.BarChart(
seriesList,
animate: animate,
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}


UPDATED 2: FIXED



Main.dart



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;

class PostDetailsPage extends StatefulWidget {
static String tag = 'post-details-page';

@override
PostDetailsPageState createState() => new PostDetailsPageState();
}

class PostDetailsPageState extends State<PostDetailsPage> {
List<charts.Series> seriesList = ;
bool animate;

void initState() {
super.initState();
seriesList = _createSampleData();
animate = false;
}

@override
Widget build(BuildContext context) {
return new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new charts.BarChart(
seriesList,
animate: animate,
),
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}









share|improve this question
























  • post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
    – Raouf Rahiche
    Nov 9 at 15:52










  • Updated with all code.
    – El Hombre Sin Nombre
    Nov 9 at 16:21










  • you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
    – Raouf Rahiche
    Nov 9 at 16:30










  • Can you put a example?
    – El Hombre Sin Nombre
    Nov 9 at 16:46













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I´m trying to navigate between two pages. In second page I need a constructor so i need to declare the variable null in first page and initialize it in the second page.



In main.dart (first page) i have similar to



PostDetailsPage.tag: (context) => PostDetailsPage(new List()),


In the second page (PostDetailsPage) i have this



final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});


When i go to page two return




< List < Series< dynamic, dynamic > > is not a subtype of type < List < Series< dynamic, String>>




So how can i solve? Initializate the value in first page and pass it? Initializate value as null in first page and pass it?



UPDATED



Main.dart class



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';


void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(new List()),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart class



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;


class PostDetailsPage extends StatelessWidget{
static String tag = 'post-details-page';
final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});

/// Creates a [BarChart] with sample data and no transition.
factory PostDetailsPage.withSampleData() {
return new PostDetailsPage(
_createSampleData(),
// Disable animations for image tests.
animate: false,
);
}


@override
Widget build(BuildContext context) {
return new charts.BarChart(
seriesList,
animate: animate,
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}


UPDATED 2: FIXED



Main.dart



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;

class PostDetailsPage extends StatefulWidget {
static String tag = 'post-details-page';

@override
PostDetailsPageState createState() => new PostDetailsPageState();
}

class PostDetailsPageState extends State<PostDetailsPage> {
List<charts.Series> seriesList = ;
bool animate;

void initState() {
super.initState();
seriesList = _createSampleData();
animate = false;
}

@override
Widget build(BuildContext context) {
return new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new charts.BarChart(
seriesList,
animate: animate,
),
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}









share|improve this question















I´m trying to navigate between two pages. In second page I need a constructor so i need to declare the variable null in first page and initialize it in the second page.



In main.dart (first page) i have similar to



PostDetailsPage.tag: (context) => PostDetailsPage(new List()),


In the second page (PostDetailsPage) i have this



final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});


When i go to page two return




< List < Series< dynamic, dynamic > > is not a subtype of type < List < Series< dynamic, String>>




So how can i solve? Initializate the value in first page and pass it? Initializate value as null in first page and pass it?



UPDATED



Main.dart class



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';


void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(new List()),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart class



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;


class PostDetailsPage extends StatelessWidget{
static String tag = 'post-details-page';
final List<charts.Series> seriesList;
final bool animate;

PostDetailsPage(this.seriesList, {this.animate});

/// Creates a [BarChart] with sample data and no transition.
factory PostDetailsPage.withSampleData() {
return new PostDetailsPage(
_createSampleData(),
// Disable animations for image tests.
animate: false,
);
}


@override
Widget build(BuildContext context) {
return new charts.BarChart(
seriesList,
animate: animate,
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}


UPDATED 2: FIXED



Main.dart



import 'package:flutter/material.dart';
import 'package:fluttercrud/screens/login_page.dart';
import 'package:fluttercrud/screens/home_page.dart';
import 'package:fluttercrud/screens/partials/list_post.dart';
import 'package:fluttercrud/screens/maps_page.dart';
import 'package:fluttercrud/screens/post_details_page.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
final routes = <String, WidgetBuilder>{
LoginPage.tag: (context) => LoginPage(),
HomePage.tag: (context) => HomePage(),
ListPost.tag: (context) => ListPost(),
MapsPage.tag: (context) => MapsPage(),
PostDetailsPage.tag: (context) => PostDetailsPage(),
};

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'iGota',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch : Colors.blue,
),
home: LoginPage(),
routes: routes,
);
}
}


PostDetailsPage.dart



import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;

class PostDetailsPage extends StatefulWidget {
static String tag = 'post-details-page';

@override
PostDetailsPageState createState() => new PostDetailsPageState();
}

class PostDetailsPageState extends State<PostDetailsPage> {
List<charts.Series> seriesList = ;
bool animate;

void initState() {
super.initState();
seriesList = _createSampleData();
animate = false;
}

@override
Widget build(BuildContext context) {
return new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new charts.BarChart(
seriesList,
animate: animate,
),
);
}

/// Create one series with sample hard coded data.
static List<charts.Series<OrdinalSales, String>> _createSampleData() {
final data = [
new OrdinalSales('2014', 5),
new OrdinalSales('2015', 25),
new OrdinalSales('2016', 100),
new OrdinalSales('2017', 75),
];

return [
new charts.Series<OrdinalSales, String>(
id: 'Sales',
colorFn: (_, __) => charts.MaterialPalette.blue.shadeDefault,
domainFn: (OrdinalSales sales, _) => sales.year,
measureFn: (OrdinalSales sales, _) => sales.sales,
data: data,
)
];
}
}

/// Sample ordinal data type.
class OrdinalSales {
final String year;
final int sales;

OrdinalSales(this.year, this.sales);
}






dart flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 20:03

























asked Nov 9 at 15:39









El Hombre Sin Nombre

176214




176214












  • post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
    – Raouf Rahiche
    Nov 9 at 15:52










  • Updated with all code.
    – El Hombre Sin Nombre
    Nov 9 at 16:21










  • you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
    – Raouf Rahiche
    Nov 9 at 16:30










  • Can you put a example?
    – El Hombre Sin Nombre
    Nov 9 at 16:46


















  • post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
    – Raouf Rahiche
    Nov 9 at 15:52










  • Updated with all code.
    – El Hombre Sin Nombre
    Nov 9 at 16:21










  • you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
    – Raouf Rahiche
    Nov 9 at 16:30










  • Can you put a example?
    – El Hombre Sin Nombre
    Nov 9 at 16:46
















post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
– Raouf Rahiche
Nov 9 at 15:52




post the real code, what are you passing as an argument for PostDetailsPage because the problem is just in the types you need to be explicit about them
– Raouf Rahiche
Nov 9 at 15:52












Updated with all code.
– El Hombre Sin Nombre
Nov 9 at 16:21




Updated with all code.
– El Hombre Sin Nombre
Nov 9 at 16:21












you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
– Raouf Rahiche
Nov 9 at 16:30




you are passing an invalid list new List() to PostDetailsPage so you need to provide a real list as an argument
– Raouf Rahiche
Nov 9 at 16:30












Can you put a example?
– El Hombre Sin Nombre
Nov 9 at 16:46




Can you put a example?
– El Hombre Sin Nombre
Nov 9 at 16:46












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You can fix your issue by explicitly declaring the type on the List when you pass it in.



PostDetailsPage.tag: (context) => PostDetailsPage(List<charts.Series<dynamic, String>>()),



Or, you can explicitly declare the type of the list itself on the page itself:



final List<charts.Series<dynamic, String>> seriesList;



I think the intended way for the charts library to work is that you pass in an already initialized list of chart data, which the page then renders. If you want to return just with the given sample data, you should just use the given factory method PostDetailsPage.withSampleData().






share|improve this answer





















  • See the updated 2, i fix my problem.
    – El Hombre Sin Nombre
    Nov 9 at 21:02










  • @ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
    – Ringil
    Nov 9 at 21:07













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228845%2fcan%25c2%25b4t-pass-null-variable-between-two-pages-in-flutter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You can fix your issue by explicitly declaring the type on the List when you pass it in.



PostDetailsPage.tag: (context) => PostDetailsPage(List<charts.Series<dynamic, String>>()),



Or, you can explicitly declare the type of the list itself on the page itself:



final List<charts.Series<dynamic, String>> seriesList;



I think the intended way for the charts library to work is that you pass in an already initialized list of chart data, which the page then renders. If you want to return just with the given sample data, you should just use the given factory method PostDetailsPage.withSampleData().






share|improve this answer





















  • See the updated 2, i fix my problem.
    – El Hombre Sin Nombre
    Nov 9 at 21:02










  • @ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
    – Ringil
    Nov 9 at 21:07

















up vote
0
down vote













You can fix your issue by explicitly declaring the type on the List when you pass it in.



PostDetailsPage.tag: (context) => PostDetailsPage(List<charts.Series<dynamic, String>>()),



Or, you can explicitly declare the type of the list itself on the page itself:



final List<charts.Series<dynamic, String>> seriesList;



I think the intended way for the charts library to work is that you pass in an already initialized list of chart data, which the page then renders. If you want to return just with the given sample data, you should just use the given factory method PostDetailsPage.withSampleData().






share|improve this answer





















  • See the updated 2, i fix my problem.
    – El Hombre Sin Nombre
    Nov 9 at 21:02










  • @ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
    – Ringil
    Nov 9 at 21:07















up vote
0
down vote










up vote
0
down vote









You can fix your issue by explicitly declaring the type on the List when you pass it in.



PostDetailsPage.tag: (context) => PostDetailsPage(List<charts.Series<dynamic, String>>()),



Or, you can explicitly declare the type of the list itself on the page itself:



final List<charts.Series<dynamic, String>> seriesList;



I think the intended way for the charts library to work is that you pass in an already initialized list of chart data, which the page then renders. If you want to return just with the given sample data, you should just use the given factory method PostDetailsPage.withSampleData().






share|improve this answer












You can fix your issue by explicitly declaring the type on the List when you pass it in.



PostDetailsPage.tag: (context) => PostDetailsPage(List<charts.Series<dynamic, String>>()),



Or, you can explicitly declare the type of the list itself on the page itself:



final List<charts.Series<dynamic, String>> seriesList;



I think the intended way for the charts library to work is that you pass in an already initialized list of chart data, which the page then renders. If you want to return just with the given sample data, you should just use the given factory method PostDetailsPage.withSampleData().







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 9 at 20:53









Ringil

3,40021025




3,40021025












  • See the updated 2, i fix my problem.
    – El Hombre Sin Nombre
    Nov 9 at 21:02










  • @ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
    – Ringil
    Nov 9 at 21:07




















  • See the updated 2, i fix my problem.
    – El Hombre Sin Nombre
    Nov 9 at 21:02










  • @ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
    – Ringil
    Nov 9 at 21:07


















See the updated 2, i fix my problem.
– El Hombre Sin Nombre
Nov 9 at 21:02




See the updated 2, i fix my problem.
– El Hombre Sin Nombre
Nov 9 at 21:02












@ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
– Ringil
Nov 9 at 21:07






@ElHombreSinNombre As you found yourself, you can modify your list with a StatefulWidget, but unless you intend your graph to be heavily dynamic and need to change the list value frequently, it would probably be better to use a StatelessWidget
– Ringil
Nov 9 at 21:07




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228845%2fcan%25c2%25b4t-pass-null-variable-between-two-pages-in-flutter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff