Skip to content

Commit d4065db

Browse files
committed
Fix analyzer warnings/infos
1 parent b0ce252 commit d4065db

File tree

9 files changed

+31
-23
lines changed

9 files changed

+31
-23
lines changed

packages/firebase_app_installations/firebase_app_installations/example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class _InstallationsCardState extends State<InstallationsCard> {
7272
String id = 'None';
7373
String authToken = 'None';
7474

75-
init() async {
75+
void init() async {
7676
await getId();
7777
await getAuthToken();
7878
}
@@ -101,7 +101,7 @@ class _InstallationsCardState extends State<InstallationsCard> {
101101
}
102102
}
103103

104-
Future<void> getAuthToken([forceRefresh = false]) async {
104+
Future<void> getAuthToken([bool forceRefresh = false]) async {
105105
try {
106106
final token = await FirebaseInstallations.instance.getToken(forceRefresh);
107107
setState(() {

packages/firebase_app_installations/firebase_app_installations_platform_interface/lib/firebase_app_installations_platform_interface.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
library firebase_app_installations_platform_interface;
5+
library;
66

77
export 'src/platform_interface/firebase_app_installations_platform_interface.dart';

packages/firebase_app_installations/firebase_app_installations_web/lib/src/interop/installations_interop.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
@JS('firebase_installations')
6-
library firebase_interop.installations;
6+
library;
77

88
import 'dart:js_interop';
99

packages/firebase_auth/firebase_auth/example/lib/auth.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ class _AuthGateState extends State<AuthGate> {
256256
height: 50,
257257
child: SignInButton(
258258
button,
259-
onPressed: authButtons[button],
259+
// Null check is required by some versions of Dart.
260+
// ignore: unnecessary_null_checks
261+
onPressed: authButtons[button]!,
260262
),
261263
),
262264
),

packages/firebase_database/firebase_database_web/lib/src/database_reference_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DatabaseReferenceWeb extends QueryWeb
7373
}
7474

7575
@override
76-
Future<void> setPriority(priority) async {
76+
Future<void> setPriority(Object? priority) async {
7777
try {
7878
await _delegate.setPriority(priority);
7979
} catch (e, s) {

packages/firebase_database/firebase_database_web/lib/src/interop/database.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class DatabaseReference<T extends database_interop.ReferenceJsImpl>
126126
///
127127
/// This method returns [ThenableReference], [DatabaseReference]
128128
/// with a [Future] property.
129-
ThenableReference push([value]) => ThenableReference.fromJsObject(
129+
ThenableReference push([Object? value]) => ThenableReference.fromJsObject(
130130
database_interop.push(jsObject, value?.jsify()));
131131

132132
/// Removes data from actual database location.
@@ -149,8 +149,8 @@ class DatabaseReference<T extends database_interop.ReferenceJsImpl>
149149
/// Sets a priority for data at actual database location.
150150
///
151151
/// The [priority] must be a [String], [num] or `null`, or the error is thrown.
152-
Future setPriority(priority) =>
153-
database_interop.setPriority(jsObject, priority).toDart;
152+
Future setPriority(Object? priority) =>
153+
database_interop.setPriority(jsObject, priority?.jsify()).toDart;
154154

155155
/// Sets data [newVal] at actual database location with provided priority
156156
/// [newPriority].
@@ -676,12 +676,11 @@ class OnDisconnect
676676
/// See: <https://firebase.google.com/docs/reference/js/firebase.database.ThenableReference>.
677677
class ThenableReference
678678
extends DatabaseReference<database_interop.ThenableReferenceJsImpl> {
679-
late final Future<DatabaseReference> _future = jsObject
680-
.then(((database_interop.ReferenceJsImpl reference) {
681-
DatabaseReference.getInstance(reference);
682-
}).toJS)
679+
late final Future<DatabaseReference> _future = (jsObject as JSPromise)
683680
.toDart
684-
.then((value) => value as DatabaseReference);
681+
.then((value) => DatabaseReference.getInstance(
682+
value as database_interop.ReferenceJsImpl,
683+
));
685684

686685
/// Creates a new ThenableReference from a [jsObject].
687686
ThenableReference.fromJsObject(

packages/firebase_ml_model_downloader/firebase_ml_model_downloader/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class _MyAppState extends State<MyApp> {
3535
FirebaseCustomModel? model;
3636

3737
/// Initially get the lcoal model if found, and asynchronously get the latest one in background.
38-
initWithLocalModel() async {
38+
void initWithLocalModel() async {
3939
final newModel = await FirebaseModelDownloader.instance.getModel(
4040
kModelName, FirebaseModelDownloadType.localModelUpdateInBackground);
4141

scripts/generate_versions_gradle.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: avoid_print
16+
1517
import 'dart:io';
1618

1719
import 'package:cli_util/cli_logging.dart' as logging;
@@ -36,7 +38,7 @@ void main() async {
3638

3739
// Define files using paths
3840
final globalConfig = File(globalConfigPath);
39-
41+
4042
// Check if the files exist
4143
if (!globalConfig.existsSync()) {
4244
throw Exception(
@@ -68,7 +70,7 @@ void main() async {
6870
print('File copied to: ${copiedConfig.path}');
6971

7072
final gradlePropertiesFilePath = '${package.path}/example/android/gradle.properties';
71-
extractAndWriteProperty(
73+
await extractAndWriteProperty(
7274
globalConfig: globalConfig,
7375
gradlePropertiesFile: File(gradlePropertiesFilePath),
7476
);
@@ -80,11 +82,10 @@ void main() async {
8082
final copiedConfig = await globalConfig.copy(
8183
localConfigGradleFilePath,
8284
);
83-
// ignore: avoid_print
8485
print('File copied to: ${copiedConfig.path}');
85-
86+
8687
final gradlePropertiesFilePath = '${package.path}/example/android/gradle.properties';
87-
extractAndWriteProperty(
88+
await extractAndWriteProperty(
8889
globalConfig: globalConfig,
8990
gradlePropertiesFile: File(gradlePropertiesFilePath),
9091
);
@@ -123,7 +124,7 @@ Future<void> extractAndWriteProperty({
123124
}) async {
124125

125126
const String propertyName = 'androidGradlePluginVersion';
126-
if (!await globalConfig.exists()) {
127+
if (!globalConfig.existsSync()) {
127128
print('Global config file not found: ${globalConfig.path}');
128129
return;
129130
}
@@ -141,7 +142,7 @@ Future<void> extractAndWriteProperty({
141142

142143
final value = match.group(1);
143144

144-
final lines = await gradlePropertiesFile.exists()
145+
final lines = gradlePropertiesFile.existsSync()
145146
? await gradlePropertiesFile.readAsLines()
146147
: [];
147148

scripts/generate_versions_spm.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// ignore_for_file: avoid_print
6+
57
import 'package:melos/melos.dart' as melos;
68
import 'package:glob/glob.dart';
79
import 'dart:io';
@@ -131,7 +133,11 @@ void updateVersionsPackageSwift(String firebaseiOSVersion) {
131133

132134
void updateLibraryVersionPureSwiftPlugins() {
133135
// Packages that require updating library versions
134-
const packages = ['firebase_ml_model_downloader', 'firebase_app_installations', 'cloud_functions'];
136+
const packages = [
137+
'firebase_ml_model_downloader',
138+
'firebase_app_installations',
139+
'cloud_functions',
140+
];
135141

136142
for (final package in packages) {
137143
final pubspecPath = 'packages/$package/$package/pubspec.yaml';

0 commit comments

Comments
 (0)