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

Use more descriptive types instead of dynamic maps. #497

Open
VictorUvarov opened this issue Nov 5, 2024 · 0 comments
Open

Use more descriptive types instead of dynamic maps. #497

VictorUvarov opened this issue Nov 5, 2024 · 0 comments

Comments

@VictorUvarov
Copy link
Contributor

Is your feature request related to a problem? Please describe.
All the methods that expect a Map<String,dynamic> are error prone and are a bad user experience. Not to mention maintaining the library is much more difficult.

Describe the solution you'd like
I would like to see the library make a breaking change in the name of type safety, so that the caller of the method knows exactly the options they have.

Describe alternatives you've considered
Keep using the library as is, but it makes it harder to maintain.

Additional context
Example change

void hangup([Map<String, dynamic>? options])

changes to

void hangup([TerminateOptions? options])

this improves the readability of the library code

terminate(<String, dynamic>{
        'status_code': 500,
        'reason_phrase': DartSIP_C.CausesType.CONNECTION_ERROR,
        'cause': DartSIP_C.CausesType.CONNECTION_ERROR
      });

to this

final TerminateOptions options = TerminateOptions()
        ..statusCode = 500
        ..reasonPhrase = DartSIP_C.CausesType.CONNECTION_ERROR
        ..cause = DartSIP_C.CausesType.CONNECTION_ERROR;
terminate(options);
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

Successfully merging a pull request may close this issue.

1 participant