skip to Main Content

Cast list object to another list object – Flutter

How can I cast List<TenancyEntity> to List<Tenancy> ? I use below code but get exception var a = await _tenancyLocalDataSource.getTenancyList(); var b = a!.cast<Tenancy>(); debugPrint(b.toString()); Below are the both classes TenancyEntity import 'package:hive/hive.dart'; import '../../../domain/model/tenancy.dart'; part 'tenancy_entity.g.dart'; @HiveType(typeId: 1) class…

VIEW QUESTION

Dynamic Type Casting in Dart/Flutter

I am in the middle of writing a library to dynamically serialise/deserialise any object in Dart/Flutter (Similar in idea to Pydantic for Python). However, I am finding it impossible to implement the last component, dynamic type casting. This is required…

VIEW QUESTION

Why the value doesn't change after calling the Setstate() function in flutter

import 'package:flutter/material.dart'; import 'package:get/get.dart'; //import 'package:get/get_core/src/get_main.dart'; import 'package:intl/intl.dart'; import 'package:menstrual_period_tracker/input2.dart'; import 'package:nepali_date_picker/nepali_date_picker.dart'; class Picker extends StatefulWidget { const Picker({super.key}); @override State<Picker> createState() => _PickerState(); } class _PickerState extends State<Picker> { NepaliDateTime _dateTime = NepaliDateTime.now(); void _showdatepicker() async { await showDatePicker(…

VIEW QUESTION
Back To Top
Search