This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {CRC32C} from '@google-cloud/storage'; | |
const CRC_INIT = 0; | |
const BLOCK_SIZE = 32 * 1024; | |
const CRC_HEADER_LENGTH = 4; | |
const LENGTH_HEADER_LENGTH = 2; | |
const RECORD_TYPE_HEADER_LENGTH = 1; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Example example = Example(); | |
String? prop; | |
final list = [ | |
if (example.prop != null) | |
// Guaranteed to be not-null, but I still have to force it to be not null | |
// Only this would work: | |
// generateString(example.prop!), | |
// This does not work: | |
generateString(example.prop), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'dart:math' as math; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"firestore": { | |
"rules": "firestore.rules", | |
"indexes": "firestore.indexes.json", | |
"predeploy": [ | |
"node generate_rules.js" | |
] | |
}, | |
"storage": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const path = require("path"); | |
// TODO: Add your exact paths | |
const srcFile = path.join(__dirname, "rules", "index.rules"); | |
const destFile = path.join(__dirname, "firestore.rules"); | |
fs.writeFileSync(destFile, resolveImports(srcFile)); | |
function resolveImports(filePath) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isAdmin(request) { | |
return request.auth.token.admin == true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isAdmin() { | |
return request.auth.token.admin == true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
include "functions.rules"; | |
match /someCollection/{someDocument} { | |
allow read, write: if isAdmin(); | |
} | |
} | |
} |
NewerOlder