Flutter sorted function doesn't sort correctly

I’m trying to sort a list of objects by their timestamp, but as you can see below from the timestamps the list that gets returned is just randomized. Does anyone know what issue im facing here? var sortedFixtures = fixtures.sorted((a, b) => a.fixtureDetails?.timestamp ?? 0.compareTo(b.fixtureDetails?.timestamp ?? 0)); This produces the following (the timestamp for each… Read More Flutter sorted function doesn't sort correctly

how can I implement a method that change directly the value this with dart extension

I want to know how can I change/affect the value of this with dart extensions without returning a value. Example, when I do this : "example text".cutFirstLetter(); by just executing it, I want its String value for the rest of the code to be "e", I don’t want it to be returned in function, I… Read More how can I implement a method that change directly the value this with dart extension

Can't change date with DatePicker in Flutter

MyInputField( title: "Tarih", hint: DateFormat(‘dd/MM/yyyy’).format(_selectedDate), widget: IconButton( onPressed: () { _getDateFromUser(); }, Date data I show in TextFormField. _getDateFromUser() async { DateTime? _pickerDate = await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2000), lastDate: DateTime(2030)); if (_pickerDate != null) { setState(() { _pickerDate = _selectedDate; }); } } } The _getDateFromUser() function I defined When I… Read More Can't change date with DatePicker in Flutter

How to map array of objects in flutter?

Hello I’m trying to map array of objects and return widget with some value of given objects… Like this _metapodaci?.map<Widget>((e) => Text("Naziv dokumenta je ${e.label}")), I get an error saying "The element type ‘Iterable’ can’t be assigned to the list type ‘Widget" but when I map inside text widget like this: Text("Meta podaci: ${_metapodaci.map((e) =>… Read More How to map array of objects in flutter?

Flutter ${widget.name} into TextFormField

is there any way to put ${widget.name} to hintText inside TextFormField? It works fine with other Texts widgets, but inside hintText i’ve got an error Padding( padding: EdgeInsets.all(20.0), child: TextFormField( enabled: false, decoration: const InputDecoration( border: UnderlineInputBorder(), hintText: ‘Name: ${widget.name}’, prefixIcon: Icon(Icons.done)), ), ), error here >Solution : The error in your screenshot says "Invalid… Read More Flutter ${widget.name} into TextFormField

How can i reverse container radius to specific form

i have the simple following code @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Container( width: 300, height: 100, decoration: const BoxDecoration( color: Colors.black, borderRadius: BorderRadius.only(topRight: Radius.circular(30.0),topLeft: Radius.circular(30.0),) ), ), ), ); } the outputs looks like following but i am trying to reverse it to be like following (sorry for the bad… Read More How can i reverse container radius to specific form