Fix Null safety not support json_to_dart

https://javiercbk.github.io/json_to_dart/ สามารถแปลง json ให้เป็น dart เพื่อเอาไปสร้าง model ในโปรเจค  Flutter

แต่เมื่อนำไปสร้าง model แล้วติด error ดังนี้

Fix #1

Add ‘required’ keyword

Fix #2

Add a null check(!)

Fix #3

You can also mark the field as  late
https://dart.dev/tools/diagnostic-messages#not_initialized_non_nullable_instance_field
(Visited 401 times, 1 visits today)
Spread the love
Published
Categorized as Flutter

Leave a comment