We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: Class 'QueryRow' has no instance method 'call'

i am having the following error in flutter, android studio flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: Class 'QueryRow' has no instance method 'call'. In addition to not being able to view records in the database.

3 Replies

LP Lokesh Palani Syncfusion Team May 3, 2023 12:12 PM UTC

Hi Levy,

We have checked your query on our end and kindly request that you share which control you are using. This will help us to better understand your requirements and provide more effective assistance.



LX Levy xavier de abreu replied to Lokesh Palani May 4, 2023 07:38 PM UTC

I am not able to visualize the database data in the listview, although there is no error when saving data in the database.

I can't see data in listview. I'm using the latest version of flutter and the latest version of android studio and ubuntu 18.04. I don't get any error when registering, but when running the listview I get this error.

what controls are you asking for?

// follow main code

import 'dart:io';

import 'package:flutter/material.dart';
import 'MangaService.dart';
import 'Cadastra_manga.dart';
import 'db_helper/Manga_repository.dart';
import 'model/Manga.dart';

void main() {
  runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      home: const MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  State createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  final _mangaService = MangaService();
  late List _mangaList = [];

  late Repository _repository= Repository();
  late FloatingActionButton floatingActionButton;
 // _repository = Repository();
  var mangas;
  getAllUserDetails() async {
     mangas = await _mangaService.readAllUsers();
   // _mangaList = [];
   // var mangas = await _repository.readData("manga");

    mangas.forEach((manga) {
      setState(() {
        var mangaModel = manga();
        mangaModel.id = manga['id_manga'];
        mangaModel.nome = manga['nome_manga'];


  void initState() {

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.

  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    var floatingActionButton;
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      body: /* Column( // or Row or Wrap
          children: [

              style: TextButton.styleFrom(
                  primary: Colors.white,
                  backgroundColor: Colors.red,
                  textStyle: const TextStyle(fontSize: 15)),
              onPressed: () {
                /* Navigator.push(
                          builder: (context) => Manga_View(
                            user: _userList[index],

              }, child: Container(
              color: Colors.red,
              width: 10,
              height: 10,
        itemBuilder: (BuildContext ctx, int index) {
          return Padding(
            padding: EdgeInsets.all(20),
            child: Column(
              children: [
                  style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
                 // const SizeBox(Height: 16)
        itemCount: _mangaList.length,
       //   ],

      floatingActionButton: FloatingActionButton.extended(
        onPressed: () {
              MaterialPageRoute(builder: (context) => const Cadastra_manga()))
              .then((data) {
            if (data != null) {
          // Add your onPressed code here!
        label: const Text('Adicionar Manga'),
        icon: const Icon(Icons.thumb_up),
        backgroundColor: Colors.green,

      /*floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),*/
      //), // This trailing comma makes auto-formatting nicer for build methods.

   // )

// follow repository code

import 'DatabaseConnection.dart';
import 'package:sqflite/sqflite.dart';

class Repository
  late DatabaseConnection _DatabaseConnection;
    _DatabaseConnection = DatabaseConnection();
  static Database? _database;
  Future get database async {
    if (_database != null) {
      return _database;
    } else {
      _database = await _DatabaseConnection.setDatabase();
      return _database;

  //Insert User
  insertData(table, data) async {
    var connection = await database;
    return await connection?.insert(table, data);
  //Read All Record
  readData(table) async {
    var connection = await database;
    return await connection?.query(table);

  readData2() async {
    var connection = await database;
    return await connection?.rawQuery("select MAX(id_manga) from manga");

  //Read a Single Record By ID
  readDataById(table, itemId) async {
    var connection = await database;
    return await connection?.query(table, where: 'id=?', whereArgs: [itemId]);
  //Update User
  updateData(table, data) async {
    var connection = await database;
    return await connection
        ?.update(table, data, where: 'id=?', whereArgs: [data['id']]);

  //Delete User
  deleteDataById(table, itemId) async {
    var connection = await database;
    return await connection?.rawDelete("delete from $table where id=$itemId");


// follow database connection code

import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';

class DatabaseConnection {
  Future setDatabase() async {
    var directory = await getApplicationDocumentsDirectory();
    var path = join(directory.path, 'app_manga2');
    var database =
    await openDatabase(path, version: 1, onCreate: _createDatabase);
    return database;

  Future<void> _createDatabase(Database database, int version) async {
    String MangaTable= "CREATE TABLE IF NOT EXISTS Manga ("+
        "nome_manga TEXT NOT NULL," ;

    await database.execute(MangaTable);


// follow service code

import 'dart:async';

import 'package:app_manga3/db_helper/Manga_repository.dart';
import 'package:app_manga3/model/Manga.dart';

class MangaService
  late Repository _repository;
    _repository = Repository();
  //Save User
  SaveUser(Manga manga) async{
    return await _repository.insertData('manga', manga.MangaMap());
  //Read All Users
  readAllUsers() async{
    return await _repository.readData('manga');
  //Edit User
  UpdateUser(Manga manga) async{
    return await _repository.updateData('users', manga.MangaMap());

  deleteUser(userId) async {
    return await _repository.deleteDataById('users', userId);


// follow model code

class Manga {
  int? id;
  String? nome;

  MangaMap() {
    var mapping = Map<String, dynamic>();
    mapping['id_manga'] = id ?? null;
    mapping['nome_manga'] = nome!;

    return mapping;

I couldn't find anything about it on the web.

LP Lokesh Palani Syncfusion Team May 5, 2023 07:13 AM UTC

Hi Levy,

We have checked your query, and it is related to the common Flutter platform, which is not our Syncfusion product. Please inform us if you require any additional assistance.



Live Chat Icon For mobile
Up arrow icon