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

update: added the BuildContext information to the documentation. #311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/content/docs/developer-tools/sdks/native/flutter-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ The Kinde client provides methods for a simple login / register flow which authe

```dart
...
final String token = await sdk.login();
// or sdk.login(type: AuthFlowType.pkce) for apply pkce flow
final String token = await sdk.login(context: content);
// or sdk.login(type: AuthFlowType.pkce, context: context) for apply pkce flow
Comment on lines +181 to +182
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo in the login example

There's a typo in the parameter name. It should be context instead of content.

-final String token = await sdk.login(context: content);
+final String token = await sdk.login(context: context);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
final String token = await sdk.login(context: content);
// or sdk.login(type: AuthFlowType.pkce, context: context) for apply pkce flow
final String token = await sdk.login(context: context);
// or sdk.login(type: AuthFlowType.pkce, context: context) for apply pkce flow

...
await sdk.register();
// or sdk.register(type: AuthFlowType.pkce) for apply pkce flow
await sdk.register(context: context);
// or sdk.register(type: AuthFlowType.pkce, context: context) for apply pkce flow
...
Comment on lines 179 to 186
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add explanation for the BuildContext requirement

To help developers understand the change, please add an explanation of why BuildContext is required for the login and register methods. This aligns with the PR objective of documenting BuildContext additions.

Add the following explanation before the code examples:

+### Why BuildContext is required
+
+The `login` and `register` methods require a BuildContext parameter to handle navigation and display authentication UI properly within the Flutter widget tree. This ensures that the authentication flow integrates seamlessly with your app's navigation stack.
+
### R**edirect after authentication**
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```dart
...
final String token = await sdk.login();
// or sdk.login(type: AuthFlowType.pkce) for apply pkce flow
final String token = await sdk.login(context: content);
// or sdk.login(type: AuthFlowType.pkce, context: context) for apply pkce flow
...
await sdk.register();
// or sdk.register(type: AuthFlowType.pkce) for apply pkce flow
await sdk.register(context: context);
// or sdk.register(type: AuthFlowType.pkce, context: context) for apply pkce flow
...
### Why BuildContext is required
The `login` and `register` methods require a BuildContext parameter to handle navigation and display authentication UI properly within the Flutter widget tree. This ensures that the authentication flow integrates seamlessly with your app's navigation stack.
### R**edirect after authentication**

```

Expand Down
Loading