Skip to content

Commit 3c3d735

Browse files
committed
Fixed several type errors due to dynamically-typed futures:
type 'Future<dynamic>' is not a subtype of type 'Future<int>'
1 parent a6890e8 commit 3c3d735

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9-
## [0.3.4] - 2019-01-xx
10-
### Added
9+
## [0.3.4] - 2019-01-26
10+
### Changed
11+
- Fixed a type error in `SQLiteDatabase#insertOrThrow()`
12+
- Fixed a type error in `SQLiteDatabase#replaceOrThrow()`
13+
- Fixed a type error in `SQLiteDatabase#update()`
14+
- Fixed a type error in `SQLiteDatabase#updateWithOnConflict()`
1115

1216
## [0.3.3] - 2019-01-21
1317
### Changed

lib/src/database.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ abstract class SQLiteDatabase implements SQLiteClosable {
300300
Future<int> insertOrThrow({
301301
@required final String table,
302302
@required final Map<String, dynamic> values,
303-
}) {
303+
}) async {
304304
final Map<String, dynamic> request = <String, dynamic>{
305305
'id': id,
306306
'table': table,
307307
'values': values,
308308
};
309-
return _channel.invokeMethod('insertOrThrow', request);
309+
return await _channel.invokeMethod('insertOrThrow', request);
310310
}
311311

312312
/// General method for inserting a row into the database.
@@ -457,13 +457,13 @@ abstract class SQLiteDatabase implements SQLiteClosable {
457457
Future<int> replaceOrThrow({
458458
@required final String table,
459459
@required final Map<String, dynamic> values,
460-
}) {
460+
}) async {
461461
final Map<String, dynamic> request = <String, dynamic>{
462462
'id': id,
463463
'table': table,
464464
'values': values,
465465
};
466-
return _channel.invokeMethod('replaceOrThrow', request);
466+
return await _channel.invokeMethod('replaceOrThrow', request);
467467
}
468468

469469
/// Sets whether foreign key constraints are enabled for the database.
@@ -550,15 +550,15 @@ abstract class SQLiteDatabase implements SQLiteClosable {
550550
@required final Map<String, dynamic> values,
551551
final String where,
552552
final List<String> whereArgs,
553-
}) {
553+
}) async {
554554
final Map<String, dynamic> request = <String, dynamic>{
555555
'id': id,
556556
'table': table,
557557
'values': values,
558558
'whereClause': where, // note the name mapping
559559
'whereArgs': whereArgs,
560560
};
561-
return _channel.invokeMethod('update', request);
561+
return await _channel.invokeMethod('update', request);
562562
}
563563

564564
/// Convenience method for updating rows in the database.
@@ -570,7 +570,7 @@ abstract class SQLiteDatabase implements SQLiteClosable {
570570
final String where,
571571
final List<String> whereArgs,
572572
@required final int conflictAlgorithm,
573-
}) {
573+
}) async {
574574
final Map<String, dynamic> request = <String, dynamic>{
575575
'id': id,
576576
'table': table,
@@ -579,7 +579,7 @@ abstract class SQLiteDatabase implements SQLiteClosable {
579579
'whereArgs': whereArgs,
580580
'conflictAlgorithm': conflictAlgorithm,
581581
};
582-
return _channel.invokeMethod('updateWithOnConflict', request);
582+
return await _channel.invokeMethod('updateWithOnConflict', request);
583583
}
584584

585585
/// Verifies that a SQL `SELECT` statement is valid by compiling it.

0 commit comments

Comments
 (0)