-1

I am tryin to pass data to a class in flutter but it is failing with this error and i dont know how to debug it, I am new to flutter:

errors.dart:187 Uncaught (in promise) Error: Invalid argument(s): feed not found

How do I know which feed it can not find?

I tried following this but ity is not working. Here is my code for main.dart:

void main() async {
   final AtomFeed feed = await RssService().getFeed();
  runApp(Start(feed));
}

class Start extends StatelessWidget {

  final AtomFeed feed;

  Start(this.feed);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 5,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(text: 'First', icon: Icon(Icons.music_note)),
                Tab(text: 'Second', icon: Icon(Icons.music_video)),
              ],
            ),
            title: Text('Start'),
            backgroundColor: Colors.green,
          ),
          body: TabBarView(
            children: [
              First(this.feed),
              MyHomePage(title: 'Wowzers!'),
            ],
          ),
        ),
      ),
    );
  }
}

Then in First:

class First extends StatelessWidget {
  final AtomFeed feed;

  First(this.feed);

 @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('RSS'),
      ),
      body: ListView.builder(
          itemCount: this.feed.items.length,
          itemBuilder: (BuildContext ctxt, int index) {
            final item = this.feed.items[index];
            return ListTile(
              title: Text(item.title),
              subtitle: Text('Published at ' +
                  DateFormat.yMd().format(DateTime.parse(item.published))),
              contentPadding: EdgeInsets.all(16.0),
              onTap: () async {
                Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (context) => WebViewContainer(
                            item.id.replaceFirst('http', 'https'))));
              },
            );
          }),
    );
  }
}
user14202986
  • 153
  • 1
  • 1
  • 9

1 Answers1

1

I renamed all feed variables to feed1, feed2, ect. The problem was not from any of my variables, it was from a method to the rss service.

user14202986
  • 153
  • 1
  • 1
  • 9