android – Undefined name ‘_LoginController’ Flutter – Dart


I’m new with flutter and Dart, I’m trying to use a method that’s on my controller called LoginController, i already imported it but when i call the instance of my controller in a widget method theres an error that says Undefined name ‘_LoginController, need some help, pls!

Here my code:

The error message:

Undefined name '_LoginController'. (Documentation)  Try correcting the name to one that is defined, or defining the name.

AndroidStudio suggestions are:
enter image description here

import 'package:delivery_app/src/login/login_controller.dart';

Instance on class _LoginPageState:

class _LoginPageState extends State<LoginPage> {

  LoginController _LoginController = new LoginController();

  void initState() {//Primer metodo que se ejecuta cuando inicial el App
    // TODO: implement initState

    SchedulerBinding.instance.addPostFrameCallback((timeStamp) {//Inicializa controladores

Widget method where I’m calling my controller instance inside a onTap function:

Widget _rowElement(BuildContext context){
  return Row(
    children: [
        'No tienes Cuenta?',
        style: TextStyle(
            color: MyColors.primaryColor
      const SizedBox(width: 7,),
        onTap: _LoginController,//<---- THE ERROR IS HERE
        child: Text(
            style: TextStyle(
                fontWeight: FontWeight.bold,
                color: MyColors.primaryColor

My controller:

import 'package:flutter/material.dart';

class LoginController {

  BuildContext? context;

  Future? init(BuildContext context){
    this.context = context;

  void registerPageRedi(BuildContext context){
    Navigator.pushNamed(context, 'register');