I got this when I was using Hive Database in Flutter. Find out answer below
-
2hii, if you already have found the answer then can you please update it here? – vivek patel Aug 19 '20 at 18:14
-
Accidentally answer was deleted – vivek yadav Apr 16 '21 at 13:41
4 Answers
I was getting the same error. when I was trying to add data into hive database using putAt()
, but from documantion i found out that putAt()
can only be used for the existing index. so switch putAt()
instruction with add()
. That solved the error.
I know the question is old, but I hope it could help someone.

- 95
- 1
- 15
problem for me was, I am accessing the empty list with index.
ex:
list=[ ] //this is empty list
list[0] // error, because I am accessing empty list.

- 163
- 1
- 4
So whenever you get this kind of Error!
Check if whatever you are saving in Hive Database is not null. I got this error while I was storing null object to database.

- 1,367
- 2
- 12
- 16
you should give and initializer for example if you want to give and array you should set a default value for example :
List<dynamic> _users = [];
this return error
but if you do this your problem will be solve :
List<dynamic> _users = [
{
"id":"",
"name:"",
"Phone:""
}
]
depends of your data that fields

- 15
- 3