Skip to content

Commit

Permalink
docs: update null-safety documentation & versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Salakar committed Feb 3, 2021
1 parent c3bcadd commit 4496159
Show file tree
Hide file tree
Showing 8 changed files with 1,626 additions and 1,603 deletions.
37 changes: 26 additions & 11 deletions docs/null-safety.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
---
id: nullsafety
id: null-safety
title: Null Safety
---

Dart [Sound null safety](https://dart.dev/null-safety) is currently in beta. Some FlutterFire packages
have preview versions of null safety implementations available to use. Please note, not all
packages have been converted - we are working through them as quickly as possible.
Dart [sound null safety](https://dart.dev/null-safety) is currently in beta, however; some FlutterFire packages
have preview versions of null-safety implementations that are available to use.

> At this time it is not possible to mix non-null safe and null safe versions of FlutterFire.
The below table outlines the latest null-safe plugin versions:

View the [GitHub discussion](https://github.com/FirebaseExtended/flutterfire/discussions/4182) for more information.

The below table outlines the currently published and available null safe plugin versions:

| Plugin | Version |
| ---------------------: | ---------------------------------------: |
| `firebase_core` | `^{{ plugins.firebase_core_ns }}` |
| `cloud_firestore` | `^{{ plugins.cloud_firestore_ns }}` |
| `firebase_auth` | `^{{ plugins.firebase_auth_ns }}` |
| `cloud_functions` | `^{{ plugins.cloud_functions_ns }}` |
| `firebase_crashlytics` | `^{{ plugins.firebase_crashlytics_ns }}` |
| `firebase_core` | `^{{ plugins.firebase_core_ns }}` |
| `firebase_crashlytics` | `^{{ plugins.firebase_crashlytics_ns }}` |
| `firebase_messaging` | `^{{ plugins.firebase_messaging_ns }}` |
| `cloud_functions` | `^{{ plugins.cloud_functions_ns }}` |

---

### Using with other non-null-safe FlutterFire packages

:::caution
Mixing currently **published** null-safety FlutterFire packages alongside **published** non-nullsafety packages is not supported.
:::

Not all FlutterFire packages have null-safety versions available yet. If you need to use the null-safe packages alongside
the non-null-safe packages then it's recommended you switch to sourcing your FlutterFire packages directly from the [main
FlutterFire repository](https://github.com/FirebaseExtended/flutterfire) (rather than pub.dev) where the packages have
compatible version constraints.

---

To provide feedback on these versions or to see progress updates: see [this GitHub discussion](https://github.com/FirebaseExtended/flutterfire/discussions/4182).
2 changes: 1 addition & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
"installation/macos",
"installation/web",
"migration",
"nullsafety",
"null-safety",
],
// AdMob: ["admob/usage", toReferenceAPI("firebase_admob")],
Analytics: ["analytics/overview", toReferenceAPI("firebase_analytics")],
Expand Down
14 changes: 13 additions & 1 deletion website/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const axios = require('axios');

const MANUAL_NS_IGNORES = {
firebase_auth: ['0.21.0-nullsafety.0'],
firebase_core: ['0.8.0-nullsafety.0', '0.8.0-nullsafety.1'],
cloud_functions: ['0.9.1-nullsafety.0', '0.9.1-nullsafety.1'],
};

// Fetch the plugins latest version from the pub API
async function fetchPluginVersions(plugin) {
try {
Expand All @@ -14,7 +20,13 @@ async function fetchPluginVersions(plugin) {
const nsList = versions
.filter(v => v.includes('nullsafety'))
// Skip an invalid version which shouldn't be used
.filter(v => v !== '0.21.0-nullsafety.0');
.filter(v => {
if (MANUAL_NS_IGNORES[plugin]) {
return !MANUAL_NS_IGNORES[plugin].includes(v);
}

return true;
});

return [nnsList[nnsList.length - 1], nsList[nsList.length - 1]];
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus-plugins/favicon-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function generateFaviconTags() {
attributes: {
rel: 'mask-icon',
href: '/favicon/safari-pinned-tab.svg',
color: '#5bbad5'
color: '#5bbad5',
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = {
projectName: 'flutterfire',
themeConfig: {
announcementBar: {
id: 'wip',
id: 'wip-nullsafety',
content:
'The FlutterFire documentation hub is currently a work in progress. <a rel="noopener" target="_blank" href="https://github.com/FirebaseExtended/flutterfire/issues/2582"><b>Check out the roadmap to learn more.</b></a>.',
'📣 <a rel="noopener" href="https://firebase.flutter.dev/docs/null-safety"><b>Null-safety versions</b></a> are now available. This FlutterFire documentation hub is currently a work in progress - <a rel="noopener" target="_blank" href="https://github.com/FirebaseExtended/flutterfire/issues/2582"><b>check out the roadmap to learn more.</b></a>.',
backgroundColor: '#13B9FD',
textColor: '#fff',
},
Expand Down
6 changes: 1 addition & 5 deletions website/firebase.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.66",
"@docusaurus/module-type-aliases": "^2.0.0-alpha.66",
"@docusaurus/preset-classic": "^2.0.0-alpha.66",
"@docusaurus/plugin-google-gtag": "^2.0.0-alpha.66",
"@docusaurus/preset-classic": "^2.0.0-alpha.66",
"@types/classnames": "^2.2.10",
"@types/lodash.get": "^4.4.6",
"@types/react": "^16.9.55",
Expand Down
Loading

0 comments on commit 4496159

Please sign in to comment.