title: A value of type 'List<Map<String, dynamic>>' can't be assigned to a variable of type 'List<ProjectBoxes>'
body: <p>I'm tryng to get a list of boxes to show in a dropdown. But I am can't convert to list map to my object list.</p>
  <p>Here's the error message:</p>
  <p>A value of type 'List&lt;Map&lt;String, dynamic&gt;&gt;' can't be assigned to a variable of type 'List'.
  Try changing the type of the variable, or casting the right-hand type to 'List'.</p>
  <p>Here's the code:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:trfcompactapp/constants.dart';
  import '../model/sql_helper.dart';
  import '../screens/drawer.dart';
  import '../controller/localizationstrf.dart';
  
  class ProjectBoxes {
    ProjectBoxes(this.boxId, this.boxName, this.lenght, this.width, this.weight,
        this.useLabel, this.labelOrientation, this.createdAt);
  
    int boxId;
    String boxName;
    int lenght;
    int width;
    int weight;
    int useLabel;
    int labelOrientation;
    DateTime createdAt;
  }
  
  class Project extends StatefulWidget {
    const Project({super.key});
  
    @override
    State&lt;Project&gt; createState() =&gt; _ProjectState();
  }
  
  class _ProjectState extends State&lt;Project&gt; {
    late ProjectBoxes selectedProjectBox;
  
    @override
    void initState() {
      super.initState();
      _refreshJournals();
  
      
    }
  
    List&lt;Map&lt;String, dynamic&gt;&gt; _journals = [];
    List&lt;Map&lt;String, dynamic&gt;&gt; _journalBoxes = [];
  
    bool _isLoading = true;
    // This function is used to fetch all data from the database
    void _refreshJournals() async {
      final data = await SQLHelper.getProjects();
      final dataBoxes = await SQLHelper.getBoxes();
      setState(() {
        _journals = data;
        _isLoading = false;
        _journalBoxes = dataBoxes;
        
  
  
        boxes = _journalBoxes;  // in this line the error happens.
  
        
      });
    }
  
    late List&lt;ProjectBoxes&gt; boxes = &lt;ProjectBoxes&gt;[];
  
    final TextEditingController _projectNameController = TextEditingController();
    final TextEditingController _fkProjectBoxController = TextEditingController();
    final TextEditingController _fkProjectPalletController =
        TextEditingController();
    final TextEditingController _fkProjectRobotController =
        TextEditingController();
  
    void _showForm(int? id) async {
      if (id != null) {
        final existingJournal =
            _journals.firstWhere((element) =&gt; element['projectId'] == id);
        final existingJournalBox = _journalBoxes.firstWhere(
            (element) =&gt; element['boxId'] == existingJournal['FK_project_box']);
        _projectNameController.text = existingJournal['projectName'];
        _fkProjectBoxController.text =
            existingJournalBox['FK_project_box'].toString();
        _fkProjectPalletController.text =
            existingJournal['FK_project_pallet'].toString();
        _fkProjectRobotController.text =
            existingJournal['FK_project_robot'].toString();
  
        selectedProjectBox = existingJournalBox[0];
        boxes = existingJournalBox[0];
      }
     
  </code></pre>