title: ListView.builder returns Null check operator used on a null value
body: <p>I'm developing a job search app that scrapes data from Indeed using Python which is being sent back to my Flutter UI as JSON data. The JSON data is being received successfully, however, Im getting an error of Null check operator used on a null value. The error appears to be stemming from the _jobSearch widget.</p>
  <p>The relevant error-causing widget was ListView lib/ui/home_page.dart:256</p>
  <p>Exception caught by scheduler library</p>
  <p>Null check operator used on a null value</p>
  <p>Here is the code:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:http/http.dart' as http;
  import 'dart:convert';
  import 'package:flutter_job_portal/theme/colors.dart';
  import 'package:flutter_job_portal/theme/images.dart';
  import 'package:flutter_job_portal/ui/bottom_menu_bar.dart';
  import 'package:flutter_job_portal/ui/job_detail_page.dart';
  
  String job = &quot;&quot;; //user's response will be assigned to this variable
  String final_response = &quot;&quot;;
  final _formkey = GlobalKey&lt;FormState&gt;(); //key created to interact with the form
  
  //function to validate and save user form
  Future&lt;void&gt; _savingData() async {
    final validation = _formkey.currentState.validate();
    if (!validation) {
      return;
    }
    _formkey.currentState.save();
  }
  
  Future&lt;List&lt;Job&gt;&gt; _getJobs() async {
    final url = 'http://127.0.0.1:5000/job';
    final response1 = await http.post(Uri.parse(url), body: json.encode({'job': job}));
  
    final response2 = await http.get(Uri.parse(url));
    final decoded = json.decode(response2.body);
  
    List&lt;Job&gt; jobs = [];
    for (var i in decoded) {
      Job job = Job(i['Title'], i['Company'], i['Location'], i['Salary']);
      jobs.add(job);
    }
    return jobs;
  }
  
  class Job {
    final String title;
    final String company;
    final String location;
    final String salary;
  
    Job(this.title, this.company, this.location, this.salary);
  }
  
  class HomePage extends StatelessWidget {
    const HomePage({Key key}) : super(key: key);
    Widget _appBar(BuildContext context) {
      return Container(
        padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
        child: Row(
          children: [
            CircleAvatar(
              backgroundImage: AssetImage(Images.user1),
            ),
            Spacer(),
            IconButton(
              icon: Icon(Icons.notifications_none_rounded),
              onPressed: () {},
            )
          ],
        ),
      );
    }
  
    Widget _header(BuildContext context) {
      return Container(
        margin: EdgeInsets.symmetric(vertical: 12),
        padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(&quot;Hello, Alex!&quot;,
                style: TextStyle(
                  fontSize: 15,
                  color: KColors.subtitle,
                  fontWeight: FontWeight.w500,
                )),
            SizedBox(
              height: 6,
            ),
            Text(&quot;Swipe to find your future&quot;,
                style: TextStyle(
                    fontSize: 20,
                    color: KColors.title,
                    fontWeight: FontWeight.bold)),
            SizedBox(
              height: 10,
            ),
            Row(
              children: [
                Expanded(
                  child: Container(
                    height: 45,
                    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                    decoration: BoxDecoration(
                        color: KColors.lightGrey,
                        borderRadius: BorderRadius.circular(10)),
                    child: Form(
                      key: _formkey,
                      child: TextFormField(
                        decoration: InputDecoration(
                          hintText: 'Search job title or keywords',
                        ),
                        onSaved: (value) {
                          job =
                              value; //getting data from the user form and assigning it to job
                        },
                      ),
                    ),
                  ),
                ),
                SizedBox(
                  width: 16,
                ),
                Container(
                  decoration: BoxDecoration(
                    color: KColors.primary,
                    borderRadius: BorderRadius.circular(10),
                  ),
                  height: 40,
                  child: IconButton(
                    color: KColors.primary,
                    icon: Icon(Icons.search, color: Colors.white),
                    onPressed: () async {
                      _savingData();
                      _getJobs();
                    },
                  ),
                )
              ],
            )
          ],
        ),
      );
    }
  
    Widget _recommendedSection(BuildContext context) {
      return Container(
        padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
        margin: EdgeInsets.symmetric(vertical: 12),
        height: 200,
        width: MediaQuery.of(context).size.width,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              &quot;Recommended&quot;,
              style: TextStyle(fontWeight: FontWeight.bold, color: KColors.title),
            ),
            SizedBox(height: 10),
            Expanded(
              child: ListView(
                scrollDirection: Axis.horizontal,
                children: [
                  _recommendedJob(context,
                      company: &quot;Google&quot;,
                      img: Images.google,
                      title: &quot;UX Designer&quot;,
                      sub: &quot;\$45,000 Remote&quot;,
                      isActive: true),
                  _recommendedJob(context,
                      company: &quot;DropBox&quot;,
                      img: Images.dropbox,
                      title: &quot;Research Assist&quot;,
                      sub: &quot;\$45,000 Remote&quot;,
                      isActive: false)
                ],
              ),
            ),
          ],
        ),
      );
    }
  
    Widget _recommendedJob(
      BuildContext context, {
      String img,
      String company,
      String title,
      String sub,
      bool isActive = false,
    }) {
      return Padding(
        padding: const EdgeInsets.only(right: 10),
        child: GestureDetector(
          onTap: () {
            Navigator.push(context, JobDetailPage.getJobDetail());
          },
          child: AspectRatio(
            aspectRatio: 1.3,
            child: Container(
              decoration: BoxDecoration(
                color: isActive ? KColors.primary : Colors.white,
                borderRadius: BorderRadius.circular(7),
              ),
              padding: EdgeInsets.all(16),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container(
                    height: 40,
                    width: 40,
                    padding: EdgeInsets.all(10),
                    decoration: BoxDecoration(
                      color: isActive ? Colors.white : KColors.lightGrey,
                      borderRadius: BorderRadius.circular(7),
                    ),
                    child: Image.asset(img),
                  ),
                  SizedBox(height: 16),
                  Text(
                    company,
                    style: TextStyle(
                      fontSize: 12,
                      color: isActive ? Colors.white38 : KColors.subtitle,
                    ),
                  ),
                  SizedBox(height: 6),
                  Text(
                    title,
                    style: TextStyle(
                      fontSize: 14,
                      color: isActive ? Colors.white : KColors.title,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(height: 6),
                  Text(
                    sub,
                    style: TextStyle(
                      fontSize: 12,
                      color: isActive ? Colors.white38 : KColors.subtitle,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      );
    }
  
    Widget _jobSearch(BuildContext context) {
      return new Container(
        child: FutureBuilder(
          future: _getJobs(),
          builder: (context, snapshot) {
            if (snapshot.data == null) {
              return Container(
                  child: Center(
                child: Text('Loading...'),
              ));
            } else {
              return ListView.builder(
                itemCount: snapshot.data.length,
                itemBuilder: (context, index) {
                  return ListTile(
                    title: Text(snapshot.data[index].location),
                  );
                },
              );
            }
          },
        ),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: KColors.background,
        bottomNavigationBar: BottomMenuBar(),
        body: SafeArea(
          child: Container(
            width: MediaQuery.of(context).size.width,
            child: SingleChildScrollView(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  _appBar(context),
                  _header(context),
                  _recommendedSection(context),
                  _jobSearch(context)
                ],
              ),
            ),
          ),
        ),
      );
    }
  }
  
  </code></pre>