Skip to content

[cloud_firestore] [firebase_performance] fix analyzer warnings #1453

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 7 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions packages/cloud_firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.12.10+2

* Fixed analyzer warnings about unused fields.

## 0.12.10+1

* Formatted method documentations.
Expand Down
6 changes: 2 additions & 4 deletions packages/cloud_firestore/lib/src/document_change.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ enum DocumentChangeType {
/// It contains the document affected and the type of change that occurred
/// (added, modified, or removed).
class DocumentChange {
DocumentChange._(Map<dynamic, dynamic> data, this._firestore)
DocumentChange._(Map<dynamic, dynamic> data, Firestore firestore)
: oldIndex = data['oldIndex'],
newIndex = data['newIndex'],
document = DocumentSnapshot._(
data['path'],
_asStringKeyedMap(data['document']),
SnapshotMetadata._(data["metadata"]["hasPendingWrites"],
data["metadata"]["isFromCache"]),
_firestore,
firestore,
),
type = DocumentChangeType.values.firstWhere((DocumentChangeType type) {
return type.toString() == data['type'];
});

final Firestore _firestore;

/// The type of change that occurred (added, modified, or removed).
final DocumentChangeType type;

Expand Down
8 changes: 3 additions & 5 deletions packages/cloud_firestore/lib/src/query_snapshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ part of cloud_firestore;

/// A QuerySnapshot contains zero or more DocumentSnapshot objects.
class QuerySnapshot {
QuerySnapshot._(Map<dynamic, dynamic> data, this._firestore)
QuerySnapshot._(Map<dynamic, dynamic> data, Firestore firestore)
: documents = List<DocumentSnapshot>.generate(data['documents'].length,
(int index) {
return DocumentSnapshot._(
Expand All @@ -16,14 +16,14 @@ class QuerySnapshot {
data['metadatas'][index]['hasPendingWrites'],
data['metadatas'][index]['isFromCache'],
),
_firestore,
firestore,
);
}),
documentChanges = List<DocumentChange>.generate(
data['documentChanges'].length, (int index) {
return DocumentChange._(
data['documentChanges'][index],
_firestore,
firestore,
);
}),
metadata = SnapshotMetadata._(
Expand All @@ -39,6 +39,4 @@ class QuerySnapshot {
final List<DocumentChange> documentChanges;

final SnapshotMetadata metadata;

final Firestore _firestore;
}
2 changes: 1 addition & 1 deletion packages/cloud_firestore/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for Cloud Firestore, a cloud-hosted, noSQL database
live synchronization and offline support on Android and iOS.
author: Flutter Team <[email protected]>
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/cloud_firestore
version: 0.12.10+1
version: 0.12.10+2

flutter:
plugin:
Expand Down
4 changes: 4 additions & 0 deletions packages/firebase_performance/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.1+3

* Fixed analyzer warnings about unused fields.

## 0.3.1+2

* Updated README instructions for contributing for consistency with other Flutterfire plugins.
Expand Down
4 changes: 0 additions & 4 deletions packages/firebase_performance/lib/src/http_metric.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class HttpMetric extends PerformanceAttributes {
final String url;
final HttpMethod httpMethod;

@override
bool _hasStarted = false;

@override
bool _hasStopped = false;

Expand Down Expand Up @@ -127,7 +124,6 @@ class HttpMetric extends PerformanceAttributes {
Future<void> start() {
if (_hasStopped) return Future<void>.value(null);

_hasStarted = true;
return FirebasePerformance.channel.invokeMethod<void>(
'HttpMetric#start',
<String, dynamic>{'handle': _handle},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ abstract class PerformanceAttributes {

final Map<String, String> _attributes = <String, String>{};

bool get _hasStarted;
bool get _hasStopped;

int get _handle;
Expand Down
1 change: 0 additions & 1 deletion packages/firebase_performance/lib/src/trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Trace extends PerformanceAttributes {

final Map<String, int> _metrics = <String, int>{};

@override
bool _hasStarted = false;

@override
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_performance/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for Google Performance Monitoring for Firebase, an a
iOS.
author: Flutter Team <[email protected]>
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_performance
version: 0.3.1+2
version: 0.3.1+3

dependencies:
flutter:
Expand All @@ -28,4 +28,4 @@ flutter:

environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=1.9.1+hotfix.5 <2.0.0"
flutter: ">=1.9.1+hotfix.5 <2.0.0"