Home > Software design >  FLUTTER - Getting this null check error, despite having null safety through out the code
FLUTTER - Getting this null check error, despite having null safety through out the code

Time:11-27

Getting this null check error, despite having null safety through out the code. I'm attaching a git repo https://github.com/HidayatBukhari01/Notes-App.git can someone please check this code and explain why am i having this errorenter image description here

On clicking icon data should have been inserted into notes table, instead it's throwing null safety error!.

CodePudding user response:

You need to check, if the value becomes null, if it does, the above error is evident. Else, you need to put the "?" operator, before the variable or function where the above error occurs, as -

type ?<varname> = <Text here>.

Even I am new to Flutter. if you get this error resolved, great, else check out on other's answers

CodePudding user response:

I went through your code and here is the mistake you done

dbHelper!

Here you said that said that dbHelper is not null but the value its getting is null and before calling this check its value in console first, and use it like this only

dbHelper
  • Related