Closed acmpo6ou closed 7 months ago
I have this in my pubspec.yaml:
dependencies:
flutter:
sdk: flutter
sweph: ^2.10.3
plugin_platform_interface: ^2.0.2
pls share the whole project
The project is just freshly created Flutter project with support for all platforms except the Web. The only files I modified are the pubspec.yaml
and that test file.
But actually, your library does work for me, it just doesn't work in tests. Because if I change the dummy Flutter example, you know the one with the button that increments a counter, then it does work:
// ...
floatingActionButton: FloatingActionButton(
onPressed: () async {
await Sweph.init();
print('sweph.swe_version = ${Sweph.swe_version()}');
print('Moon longitude on 2022-06-29 02:52:00 UTC = ${Sweph.swe_calc_ut(Sweph.swe_julday(2022, 6, 29, (2 + 52 / 60), CalendarType.SE_GREG_CAL), HeavenlyBody.SE_MOON, SwephFlag.SEFLG_SWIEPH).longitude}');
},
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
// ...
So if I modify the main.dart
like this, when I click on the button the print statements work. But in tests it doesn't work.
I even tried using testWidgets
function instead of test
, but it gets stuck on Sweph.init()
, and the test runs forever.
testWidgets('test', (WidgetTester tester) async {
await Sweph.init(epheAssets: [
"packages/sweph/assets/ephe/sepl_18.se1",
]);
print('sweph.swe_version = ${Sweph.swe_version()}');
print('Moon longitude on 2022-06-29 02:52:00 UTC = ${Sweph.swe_calc_ut(Sweph.swe_julday(2022, 6, 29, (2 + 52 / 60), CalendarType.SE_GREG_CAL), HeavenlyBody.SE_MOON, SwephFlag.SEFLG_SWIEPH).longitude}');
});
Hello! Thanks for making this plugin!
I am a complete newbie in Flutter, this is my first project. I wanted to try out your package. So I opened up the
test/widget_test.dart
, and changed its contents to this:but it fails for me with this error:
Do you know why this happens? It looks like to load the ephemeris file it needs
getApplicationSupportDirectory
function, but it can't find it?Thank you!