Skip to content

feat: Update Dart, Flutter API links and improve document structure #931

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

Merged
merged 10 commits into from
May 28, 2023
Merged
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
5 changes: 3 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -20,10 +20,11 @@ support_url: https://community.parseplatform.org
apis:
osx: https://parseplatform.org/Parse-SDK-iOS-OSX/api/
android: https://parseplatform.org/Parse-SDK-Android/api/
js: https://parseplatform.org/Parse-SDK-JS/api/master/
js: https://parseplatform.org/Parse-SDK-JS/api/
php: https://parseplatform.org/parse-php-sdk/
dotnet: https://parseplatform.org/Parse-SDK-dotNET/api/
flutter: flutter/api/
flutter: https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html
dart: https://parseplatform.org/Parse-SDK-Flutter/dart/flutter_parse_sdk/flutter_parse_sdk-library.html
parse-server: https://parseplatform.org/parse-server/api/

# Build settings
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions _includes/dart/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Getting Started

- To install the Parse Dart SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk/install) registry.

Once you have the SDK added as a dependency, initialize the SDK as early as possible in your application (e.g. in your application class) like this:

```dart
await Parse().initialize(
keyApplicationId,
keyParseServerUrl,
);
```

If you want to use secure storage or use the Flutter web/desktop SDK, please change to the below instance of `CoreStorage` as it has no dependencies on Flutter. `CoreStoreSembastImp` does not encrypt the data on the web and Web is not safe anyway. Encrypt fields manually as needed.

```dart
await Parse().initialize(
keyParseApplicationId,
keyParseServerUrl,
coreStore: await CoreStoreSembastImp.getInstance("/data"));
```

It's possible to add other parameters to work with your instance of Parse Server:

```dart
await Parse().initialize(
keyApplicationId,
keyParseServerUrl,
clientKey: keyParseClientKey, // Required for some setups
debug: true, // When enabled, prints logs to console
liveQueryUrl: keyLiveQueryUrl, // Required if using LiveQuery
autoSendSessionId: true, // Required for authentication and ACL
securityContext: securityContext, // Again, required for some setups
coreStore: CoreStoreMemoryImp()); // Non persistent mode (default): Sdk will store everything in memory instead of using Sembast as an internal DB.
```

⚠️ The master key should only be used in safe environments and never on client side. Using this package on a server should be fine.

## Early Web Support

Due to Cross-Origin Resource Sharing (CORS) restrictions, web support requires adding `X-Parse-Installation-Id` as an allowed header in the Parse Server configuration:

- When running directly via docker, set the env var `PARSE_SERVER_ALLOW_HEADERS=X-Parse-Installation-Id`.
- When running via express, set the [Parse Server option](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) `allowHeaders: ['X-Parse-Installation-Id']`.

## Desktop Support (macOS)

The security entitlements posed by the macOS framework require that your app is granted permission to open outgoing network connections, so that the Parse Flutter SDK can communicate with Parse Server. To grant this permission, add the following code:

```swift
<key>com.apple.security.network.client</key>
<true/>
```

to the following files:

```
/macOS/Runner/Release.entitlements
/macOS/Runner/DebugProfile.entitlements
```

## Network client

By default, this SDK uses the `ParseHTTPClient`. Another option is use `ParseDioClient`. This client supports the most features (for example a progress callback at the file upload), but a benchmark has shown that dio is slower than http on web.

If you want to use the `ParseDioClient`, which uses the dio network library, you can provide a custom `ParseClientCreator` at the initialization of the SDK:

```dart
await Parse().initialize(
//...
clientCreator: ({bool? sendSessionId, SecurityContext? securityContext}) => ParseDioClient(sendSessionId: sendSessionId, securityContext: securityContext),
);
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion _includes/flutter/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Getting Started

- To install the Parse Dart SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk/install) registry.
- To install the Parse Flutter SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk_flutter/install) registry.

Once you have the SDK added as a dependency, initialize the SDK as early as possible in your application (e.g. in your application class) like this:
8 changes: 4 additions & 4 deletions assets/symbols.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions css/lib/docs/components/_docs-platform.scss
Original file line number Diff line number Diff line change
@@ -185,6 +185,11 @@
width: 23px;
height: 24px;
}
svg.icon-dart{
fill: $dartPlatform;
width: 23px;
height: 24px;
}
svg.icon-js{
fill: $jsPlatform;
width: 33px;
3 changes: 3 additions & 0 deletions css/lib/docs/components/_docsearch.scss
Original file line number Diff line number Diff line change
@@ -75,6 +75,9 @@ input {
&.flutter_docs_header{
background-color: $flutterPlatform;
}
&.dart_docs_header{
background-color: $dartPlatform;
}
&.php_docs_docsearch{
background-color: $phpPlatform;
}
3 changes: 3 additions & 0 deletions css/lib/marketing/components/_herosDocs.scss
Original file line number Diff line number Diff line change
@@ -34,6 +34,9 @@
&.flutter_docs_header{
background-color: $flutterPlatform;
}
&.dart_docs_header{
background-color: $dartPlatform;
}
&.php_docs_header{
background-color: $phpPlatform;
}
1 change: 1 addition & 0 deletions css/lib/multisite/_variables.scss
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ $osxPlatform: #9CAFBA;
$androidPlatform: #00C26E;
$jsPlatform: #F5A623;
$flutterPlatform: #47c5fb;
$dartPlatform: #227ee6;
$dotnetPlatform: #922ADD;
$unityPlatform: #11A4BA;
$phpPlatform: #0E69A1;
7 changes: 7 additions & 0 deletions dart-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: redirected
sitemap: false
permalink: /dart/api/
redirect_to:
- https://parseplatform.org/Parse-SDK-Flutter/dart/flutter_parse_sdk/flutter_parse_sdk-library.html
---
21 changes: 21 additions & 0 deletions dart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Dart Guide | Parse
permalink: /dart/guide/
layout: guide
platform: dart
language: dart
display_platform: Dart
api_reference: /dart/api

sections:
- "dart/getting-started.md"
- "dart/objects.md"
- "dart/queries.md"
- "dart/cloud-code.md"
- "dart/config.md"
- "dart/files.md"
- "dart/other-features.md"
- "dart/storage.md"
- "dart/users.md"

---
4 changes: 2 additions & 2 deletions flutter-api.md
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ layout: redirected
sitemap: false
permalink: /flutter/api/
redirect_to:
- https://pub.dev/documentation/parse_server_sdk_flutter/latest/
---
- https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html
---
18 changes: 9 additions & 9 deletions flutter.md
Original file line number Diff line number Diff line change
@@ -5,18 +5,18 @@ layout: guide
platform: flutter
language: dart
display_platform: Flutter
api_reference: https://parse-community.github.io/Parse-SDK-Flutter/api
api_reference: /flutter/api

sections:
- "flutter/getting-started.md"
- "flutter/objects.md"
- "flutter/queries.md"
- "flutter/cloud-code.md"
- "flutter/config.md"
- "flutter/files.md"
- "dart/objects.md"
- "dart/queries.md"
- "dart/cloud-code.md"
- "dart/config.md"
- "dart/files.md"
- "flutter/push-notifications.md"
- "flutter/other-features.md"
- "flutter/storage.md"
- "flutter/users.md"
- "dart/other-features.md"
- "dart/storage.md"
- "dart/users.md"

---
1 change: 1 addition & 0 deletions img/dart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -79,6 +79,20 @@ layout: docs
</footer>
</div>

<div class="docs-platform">
<header class="docs-platform__header">
<span class="docs-platform__name">Dart</span>
<svg class="icon icon-dart"><use xlink:href="{{ site.baseurl }}/assets/symbols.svg#dart"></use></svg>
</header>
<ul class="docs-platform__links">
<li class="docs-platform__links"><a href="dart/guide/">Guide</a></li>
<li class="docs-platform__links"><a href="{{ site.apis.dart }}">API Reference</a></li>
</ul>
<footer class="docs-platform__footer">
<a href="https://github.com/parse-community/Parse-SDK-Flutter/releases/latest" class="btn btn--outline">Latest Downloads</a>
</footer>
</div>

<div class="docs-platform">
<header class="docs-platform__header">
<span class="docs-platform__name">JavaScript</span>