mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
database: Tolerate null as page value
This commit is contained in:
parent
2729ed31d1
commit
f81c3ed940
1 changed files with 10 additions and 20 deletions
|
|
@ -36,10 +36,8 @@ class Database extends _$Database {
|
||||||
/// This will return a list of [pageSize] persons. You can get another page
|
/// This will return a list of [pageSize] persons. You can get another page
|
||||||
/// using the [page] parameter. If a non empty [search] string is provided,
|
/// using the [page] parameter. If a non empty [search] string is provided,
|
||||||
/// the persons will get filtered based on that string.
|
/// the persons will get filtered based on that string.
|
||||||
Future<List<Person>> getPersons([int page = 0, String search]) async {
|
Future<List<Person>> getPersons([int page, String search]) async {
|
||||||
assert(page != null);
|
final offset = page != null ? page * pageSize : 0;
|
||||||
|
|
||||||
final offset = page * pageSize;
|
|
||||||
List<Person> result;
|
List<Person> result;
|
||||||
|
|
||||||
if (search == null || search.isEmpty) {
|
if (search == null || search.isEmpty) {
|
||||||
|
|
@ -66,10 +64,8 @@ class Database extends _$Database {
|
||||||
/// This will return a list of [pageSize] instruments. You can get another
|
/// This will return a list of [pageSize] instruments. You can get another
|
||||||
/// page using the [page] parameter. If a non empty [search] string is
|
/// page using the [page] parameter. If a non empty [search] string is
|
||||||
/// provided, the instruments will get filtered based on that string.
|
/// provided, the instruments will get filtered based on that string.
|
||||||
Future<List<Instrument>> getInstruments([int page = 0, String search]) async {
|
Future<List<Instrument>> getInstruments([int page, String search]) async {
|
||||||
assert(page != null);
|
final offset = page != null ? page * pageSize : 0;
|
||||||
|
|
||||||
final offset = page * pageSize;
|
|
||||||
List<Instrument> result;
|
List<Instrument> result;
|
||||||
|
|
||||||
if (search == null || search.isEmpty) {
|
if (search == null || search.isEmpty) {
|
||||||
|
|
@ -129,10 +125,8 @@ class Database extends _$Database {
|
||||||
/// using the [page] parameter. If a non empty [search] string is provided,
|
/// using the [page] parameter. If a non empty [search] string is provided,
|
||||||
/// the works will be filtered using that string.
|
/// the works will be filtered using that string.
|
||||||
Future<List<WorkInfo>> getWorks(int personId,
|
Future<List<WorkInfo>> getWorks(int personId,
|
||||||
[int page = 0, String search]) async {
|
[int page, String search]) async {
|
||||||
assert(page != null);
|
final offset = page != null ? page * pageSize : 0;
|
||||||
|
|
||||||
final offset = page * pageSize;
|
|
||||||
List<Work> works;
|
List<Work> works;
|
||||||
|
|
||||||
if (search == null || search.isEmpty) {
|
if (search == null || search.isEmpty) {
|
||||||
|
|
@ -205,10 +199,8 @@ class Database extends _$Database {
|
||||||
/// This will return a list of [pageSize] ensembles. You can get another page
|
/// This will return a list of [pageSize] ensembles. You can get another page
|
||||||
/// using the [page] parameter. If a non empty [search] string is provided,
|
/// using the [page] parameter. If a non empty [search] string is provided,
|
||||||
/// the ensembles will get filtered based on that string.
|
/// the ensembles will get filtered based on that string.
|
||||||
Future<List<Ensemble>> getEnsembles([int page = 0, String search]) async {
|
Future<List<Ensemble>> getEnsembles([int page, String search]) async {
|
||||||
assert(page != null);
|
final offset = page != null ? page * pageSize : 0;
|
||||||
|
|
||||||
final offset = page * pageSize;
|
|
||||||
List<Ensemble> result;
|
List<Ensemble> result;
|
||||||
|
|
||||||
if (search == null || search.isEmpty) {
|
if (search == null || search.isEmpty) {
|
||||||
|
|
@ -308,10 +300,8 @@ class Database extends _$Database {
|
||||||
///
|
///
|
||||||
/// This will return a list of [pageSize] recordings. You can get the other
|
/// This will return a list of [pageSize] recordings. You can get the other
|
||||||
/// pages using the [page] parameter.
|
/// pages using the [page] parameter.
|
||||||
Future<List<RecordingInfo>> getRecordings(int workId, [int page = 0]) async {
|
Future<List<RecordingInfo>> getRecordings(int workId, [int page]) async {
|
||||||
assert(page != null);
|
final offset = page != null ? page * pageSize : 0;
|
||||||
|
|
||||||
final offset = page * pageSize;
|
|
||||||
final recordings = await recordingsByWork(workId, pageSize, offset).get();
|
final recordings = await recordingsByWork(workId, pageSize, offset).get();
|
||||||
|
|
||||||
final List<RecordingInfo> result = [];
|
final List<RecordingInfo> result = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue