srawlins / timezone

Time zone database and time zone aware DateTime object for Dart.
BSD 2-Clause "Simplified" License
101 stars 52 forks source link

Exception on Ubuntu #179

Open cheasonxie opened 11 months ago

cheasonxie commented 11 months ago

my code is following:

import 'package:timezone/standalone.dart' as tz;

main() async {
  await tz.initializeTimeZone();
  tz.Location detroit = tz.getLocation('America/Detroit');
  tz.TZDateTime now = tz.TZDateTime.now(detroit);
  print('Detroit time:$now');
}

this code run ok on win10, but exception occur on ubuntu while calling initializeTimeZone():

Invalid argument (uri): Value must be a String or a Uri: null
#0      initializeTimeZone.<anonymous closure> (package:timezone/standalone.dart:81)
#1      _RootZone.runUnary (dart:async/zone.dart:1661)
#2      _FutureListener.handleError (dart:async/future_impl.dart:165)
#3      Future._propagateToListeners.handleError (dart:async/future_impl.dart:796)
#4      Future._propagateToListeners (dart:async/future_impl.dart:817)
#5      Future._completeError (dart:async/future_impl.dart:592)
#6      _SuspendState._createAsyncStarCallback.<anonymous closure> (dart:async-patch/async_patch.dart:379)
<asynchronous suspension>