'Millisec convert to date can't show at emulator

I try to convert int ts=1646274840000 to a date. When I start to debug this code can read and at variable it success show the output but at emulator, the output does not show the date. Someone can help me?

My code

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

import 'api_service.dart';

class AppointmentList extends StatefulWidget {
  final String? token;
  AppointmentList({
    Key? key,
    this.token
  }) : super(key: key);

  @override
  _AppointmentListState createState() => _AppointmentListState();
}

class _AppointmentListState extends State<AppointmentList> {
  @override
  void initState() {
    super.initState();
    APIService.getAppointmentList(widget.token!);
    
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Appointment Listing"),
      ),
      //body: _appointmentListUI(),
      body: _time(),
    );
  }
}
  _time() {
    
    int ts=1646274840000; 
    DateTime tsdate = DateTime.fromMillisecondsSinceEpoch(ts);
String fdatetime = DateFormat('dd-MMM-yyy').format(tsdate);
if (kDebugMode) {
  print(fdatetime);
} 
  
  }

The variable show, the date but at emulator does not show the date

At the variable show the date but at emulator does not show the date



Solution 1:[1]

_time() {
            
    int ts=1646274840000; 
    DateTime tsdate = DateTime.fromMillisecondsSinceEpoch(ts);
    String fdatetime = DateFormat('dd-MMM-yyy').format(tsdate);
    return Container(
        child: Text(fdatetime),);
   
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adrian Mole