I have a function like this:
Map<int, ChapterInfo> _chapterInfoMap = HashMap();
ChapterInfo? getChapterInfo(int id) {
ChapterInfo? info = _chapterInfoMap[id];
if (info == null) {
// do some other thing to find info. if I still get null, throw an exception.
}
}
So, if I don't catch any exception, “info" shouldn't be null. But how can I remove the "?"?