Closed Sasikumar3595 closed 1 year ago
@srawlins
Any update/suggestion on this?
Hi Team, Expecting a rapid solution to this. do the needful.
Thanks for your question. Questions like this are better asked on a large programming forum like StackOverflow, with more eyes to look at a question. I cannot answer your question here without you are initializing from the dart library, without seeing the initialization code, without knowing the version of the timezone package used. This would be good information to include in a post to StackOverflow. Also it would be good to indicate why you are requesting the 2020a database, and not the latest.
@srawlins ,
Code sample:
@override
void initState() {
_loadDataBase();
super.initState();
}
Future<bool> _loadDataBase() async {
final ByteData byteData =
await rootBundle.load('packages/timezone/data/2020a.tzf');
initializeDatabase(byteData.buffer.asUint8List());
return true;
}
void _refresh() {
DateTime date = DateTime.now();
Location location = getLocation('Australia/Darwin');
DateTime convertedDate = TZDateTime.from(date, location);
print(convertedDate);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Container(
),
),
floatingActionButton: FloatingActionButton(
onPressed: _refresh,
tooltip: 'Convert Date',
child: const Icon(Icons.refresh),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
TimeZone package: timezone 0.8.0
Note: It was working fine on other than aws ec2 servers.
@srawlins please update on how this can be fixed...We are working on a crucial project and all was working fine during dev and when we moved the code to aws..it stopped working.... your help is greatly appreciated...
Sorry about the crucial project. Please try a user forum.
@srawlins ,
We asked the same on StackOverFlow forum also StackOverFlow link: https://stackoverflow.com/questions/72008671/widget-assets-are-not-loaded-on-aws-ec2-server
for this issue you need to add MIME TYPE into your server, so it can accept the file type of .tzf and it will work fine.
Here is the solution.
We are creating a new widget with timezone package, and the package makes an error while loading the widget on aws ec2 server.
It shows the error below:
Uncaught Unable to load asset: packages/timezone/data/2020a.tzf
Error screenshots: