rand dart fix
This commit is contained in:
@@ -49,9 +49,7 @@ class App {
|
||||
this.messagingSenderId,
|
||||
this.appId,
|
||||
String? database,
|
||||
}) : _name = database,
|
||||
assert(apiKey != null),
|
||||
assert(projectId != null);
|
||||
}) : _name = database;
|
||||
|
||||
factory App.fromJson(Map<String, dynamic> json) {
|
||||
return App(
|
||||
|
||||
@@ -14,7 +14,7 @@ class FirestoreClientImpl extends FirestoreHttpClient {
|
||||
|
||||
@override
|
||||
Future<dynamic> sendHttpRequest(Uri uri,
|
||||
{bool needsToken: true,
|
||||
{bool needsToken = true,
|
||||
String? extract,
|
||||
Map<String, dynamic>? body}) async {
|
||||
var request = new HttpRequest();
|
||||
|
||||
@@ -26,10 +26,6 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
||||
FirestoreAccessToken token;
|
||||
|
||||
bool isCurrentTokenValid(bool refreshable) {
|
||||
if (token == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (refreshable) {
|
||||
var now = DateTime.now();
|
||||
return token.expiresAt.difference(now).abs().inSeconds >= 60;
|
||||
@@ -81,13 +77,11 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
||||
|
||||
@override
|
||||
CollectionReference collection(String path) {
|
||||
assert(path != null);
|
||||
return CollectionReference(this, path.split('/'));
|
||||
}
|
||||
|
||||
@override
|
||||
DocumentReference document(String path) {
|
||||
assert(path != null);
|
||||
return DocumentReference(this, path.split('/'));
|
||||
}
|
||||
|
||||
@@ -99,22 +93,22 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
||||
|
||||
Future<Map<String, dynamic>?> getJsonMap(String url,
|
||||
{Map<String, dynamic>? body,
|
||||
String? extract: "response",
|
||||
bool standard: true}) async {
|
||||
String? extract = "response",
|
||||
bool standard = true}) async {
|
||||
return (await sendHttpRequest(_apiUrl(url, standard),
|
||||
body: body, extract: extract)) as Map<String, dynamic>?;
|
||||
}
|
||||
|
||||
Future<List<dynamic>?> getJsonList(String url,
|
||||
{Map<String, dynamic>? body,
|
||||
String extract: "response",
|
||||
bool standard: true}) async {
|
||||
String extract = "response",
|
||||
bool standard = true}) async {
|
||||
return (await sendHttpRequest(_apiUrl(url, standard),
|
||||
body: body, extract: extract)) as List<dynamic>?;
|
||||
}
|
||||
|
||||
Future<dynamic> sendHttpRequest(Uri uri,
|
||||
{bool needsToken: true, String? extract, Map<String, dynamic>? body});
|
||||
{bool needsToken = true, String? extract, Map<String, dynamic>? body});
|
||||
|
||||
Uri _apiUrl(String path, bool standard) {
|
||||
path = standard ? "$path" : path;
|
||||
|
||||
@@ -27,7 +27,7 @@ class FirestoreClientImpl extends FirestoreHttpClient {
|
||||
|
||||
@override
|
||||
Future<dynamic> sendHttpRequest(Uri uri,
|
||||
{bool needsToken: true,
|
||||
{bool needsToken = true,
|
||||
String? extract,
|
||||
Map<String, dynamic>? body}) async {
|
||||
if (endpoints.enableProxyMode) {
|
||||
|
||||
@@ -25,7 +25,6 @@ class DocumentReference implements FirestoreReference {
|
||||
/// Returns the reference of a collection contained inside of this
|
||||
/// document.
|
||||
CollectionReference collection(String collectionPath) {
|
||||
assert(collectionPath != null);
|
||||
return CollectionReference(client, <String>[path, collectionPath]);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,8 @@ const List<String> _passwordEnvVars = const <String>[
|
||||
String? _getEnvKey(List<String> possible) {
|
||||
for (var key in possible) {
|
||||
var dartEnvValue = new String.fromEnvironment(key);
|
||||
if (dartEnvValue != null) {
|
||||
return dartEnvValue;
|
||||
}
|
||||
|
||||
return dartEnvValue;
|
||||
|
||||
if (Platform.environment.containsKey(key) &&
|
||||
Platform.environment[key]!.isNotEmpty) {
|
||||
return Platform.environment[key];
|
||||
|
||||
Reference in New Issue
Block a user