Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: throwing error when define argumentNames with double quotes #6

Closed
NarHakobyan opened this issue Dec 4, 2019 · 6 comments
Closed

Comments

@NarHakobyan
Copy link

NarHakobyan commented Dec 4, 2019

@FFRoute(
  name: 'rexiapp://sms-confirm',
  routeName: 'sms-confirm',
  argumentNames: ['phoneNumber'],
)
FormatException: Unexpected character (at character 2)
['phoneNumber']
@zmtzawqlp zmtzawqlp changed the title Bug: throwing error when wrapping arguments in single quotes Bug: throwing error when define argumentNames with double quotes Dec 5, 2019
@zmtzawqlp zmtzawqlp pinned this issue Dec 5, 2019
@zmtzawqlp
Copy link
Member

plz, chang quote to double quotes, check all of annotation routes

@AlexV525
Copy link
Member

AlexV525 commented Dec 5, 2019

For users who has the same issue, please be aware that you can only use double quote (") in argumentNames due to single quotes cannot be decoded in JSON format string. If any single quote have been provided, the FormatException will be thrown.

@AlexV525
Copy link
Member

AlexV525 commented Dec 5, 2019

@NarHakobyan The exception might not caused by the code you wrote at here, please make sure that there're no single quotes in your arguments.

@NarHakobyan
Copy link
Author

yeah, but I have linter which requires single quotes, it's confusing that any third party library requires to write with different code style

@NarHakobyan
Copy link
Author

NarHakobyan commented Dec 5, 2019

I think need to change builder, so it can parse either single quotes and double quotes

@AlexV525
Copy link
Member

AlexV525 commented Dec 5, 2019

@NarHakobyan The root cause was the official JsonDecoder, it cannot recognized single quotes in JSON. You can try at dartpad, with single quotes string the decoder cannot decode the string to json successfully.

import 'dart:convert';

void main() {
  String a = "{'something': 'somevalue'}";
  print(jsonDecode(a));
}
Uncaught Error: FormatException: SyntaxError: Unexpected token ' in JSON at position 1

iota9star added a commit to iota9star/ff_annotation_route that referenced this issue Feb 4, 2020
iota9star added a commit to iota9star/ff_annotation_route that referenced this issue Feb 4, 2020
iota9star added a commit to iota9star/ff_annotation_route that referenced this issue Feb 4, 2020
iota9star added a commit to iota9star/ff_annotation_route that referenced this issue Feb 5, 2020
zmtzawqlp added a commit that referenced this issue Feb 14, 2020
@AlexV525 AlexV525 unpinned this issue Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants