Santos-Enoque / flutter-web-dashboard-template

270 stars 203 forks source link

Error right at the beginning (getX-turtorial) "Error: Type 'CounterController' not found" #24

Closed MrFunkeyfreak closed 2 years ago

MrFunkeyfreak commented 2 years ago

Hey,

I am trying to learn flutter from your video, but right at the beginning I get this errors: (in the getX tutorial)

this is a screenshot of the error message

lib/screens/home.dart:6:9: Error: Type 'CounterController' not found.
  final CounterController counterController = Get.put(CounterController());
        ^^^^^^^^^^^^^^^^^
lib/screens/home.dart:6:9: Error: 'CounterController' isn't a type.
  final CounterController counterController = Get.put(CounterController());
        ^^^^^^^^^^^^^^^^^
lib/screens/home.dart:6:55: Error: Method not found: 'CounterController'.
  final CounterController counterController = Get.put(CounterController());
                                                      ^^^^^^^^^^^^^^^^^
lib/screens/home.dart:26:93: Error: Expected ';' after this.
      floatingActionButton: FloatingActionButton(onPressed: () {counterController.increment()},
                                                                                          ^

I have definied the class "CounterController" in the file "counterController.dart".

import 'package:get/get.dart';

class CounterController extends GetxController{
  var counter = 0.obs;

  void increment(){
    counter++;
  }
}

I did everything which is mentioned in the video till 23min.

Can u please check my code and help me? I think it's a simple beginner mistake, but I don't know how to fix it. I hope u can help me.

https://github.com/MrFunkeyfreak/Flutter-Web-Course