nubank / nuvigator

A powerful routing abstraction over Flutter Navigator, with nested Navigator and Deeplinks
Apache License 2.0
275 stars 33 forks source link

Error occurred when pass argument to ScreenRoute method #53

Closed tnitsiri closed 4 years ago

tnitsiri commented 4 years ago

When I run flutter pub run build_runner watch --delete-conflicting-outputs generate file not created and show some error outputs

line 1, column 924: Expected to find '}'. ╷ 1 │ Future toMerchantScreen() { return nuvigator.pushNamed(MerchantRoutes.merchantScreen,); } Future pushReplacementToMerchantScreen({TO result}) { return nuvigator.pushReplacementNamed<Object, TO>(MerchantRoutes.merchantScreen, result: result,); } Future pushAndRemoveUntilToMerchantScreen({@required RoutePredicate predicate}) { return nuvigator.pushNamedAndRemoveUntil(MerchantRoutes.merchantScreen, predicate,); } Future popAndPushToMerchantScreen({TO result}) { return nuvigator.popAndPushNamed<Object, TO>(MerchantRoutes.merchantScreen, result: result,); } Future toMerchantPhotosScreen({List<AssetImageModel> photos}) { return nuvigator.pushNamed(MerchantRoutes.merchantPhotosScreen, arguments: {'photos': photos,},); } Future pushReplacementToMerchantPhotosScreen({List<AssetImageModel> photos, TO result}) { return nuvigator.pushReplacementNamed<Object, TO>(MerchantRoutes.merchantPhotosScreen, arguments: {'photos': photos,}, result: result,); } Future pushAndRemoveUntilToMerchantPhotosScreen({List<AssetImageModel> photos, @required RoutePredicate predicate}) { return nuvigator.pushNamedAndRemoveUntil(MerchantRoutes.merchantPhotosScreen, predicate, arguments: {'photos': photos,},); } Future popAndPushToMerchantPhotosScreen({List<AssetImageModel> photos, TO result}) { return nuvigator.popAndPushNamed<Object, TO>(MerchantRoutes.merchantPhotosScreen, arguments: {'photos': photos,}, result: result,); }

@NuRoute()
ScreenRoute merchantPhotosScreen({
  List<AssetImageModel> photos,
}) => ScreenRoute(
  builder: (BuildContext context) => MerchantPhotosScreen(
    photos: photos,
  ),
);
stwonary commented 4 years ago

it's a related issue mentioned in #48. the workaround is to downgrade to 0.7.0

tnitsiri commented 4 years ago

I tried but still error build_runner: ^1.10.3 nuvigator: ^0.7.0

leoiacovini commented 4 years ago

We are investigating, but the problem is related to this bump: https://github.com/nubank/nuvigator/pull/52/files#diff-8b7e9df87668ffa6a04b32e1769a33434999e54ae081c52e5d943c541d4c0d25L16-R16

Can you pin the version of the analyzer to be lower than 0.41.0 (be sure to clean the dependencies to avoid cache), and try again?

tnitsiri commented 4 years ago

Problem solved for my case on analyzer: ^0.39.17 build_runner: ^1.10.2 nuvigator: ^0.7.1

leoiacovini commented 4 years ago

This should have been solved in the new 0.7.2 - sorry for the trouble

tnitsiri commented 4 years ago

Thank you, it's works fine now for all latest version.