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

fix: passing getUser exceptions to Method Channel #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

luisfelipeas5
Copy link

Uses FlutterResult on SwiftRoamFlutterPlugin.swift (iOS) and Result on RoamFlutterPlugin.java to return for the flutter the errors of getUser method.

With this fix refactor, we can use try catch, like:

try {
  await Roam.getUser(
    userId: "",
    callBack: ({user}) => debugPrint(user),
  );
} catch (exception, stackTrace) {
  log(
    "Roam method invokation exception: "
    "methodName = getUser "
    "exception = ${exception.toString()}",
    stackTrace: stackTrace,
  );
}

Note for future improvement: could be better not have callbacks on this methods to allow this type of code:

final user = await Roam.getUser(userId: "");
debugPrint(user);

@luisfelipeas5 luisfelipeas5 marked this pull request as ready for review May 8, 2023 20:56
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 this pull request may close these issues.

1 participant