Skip to content

Commit

Permalink
Merge pull request #59 from shounakmulay/feature/null-safety
Browse files Browse the repository at this point in the history
Feature/null safety - Enable null safety
  • Loading branch information
shounakmulay authored Mar 6, 2021
2 parents 482dec3 + faec738 commit 5620bf4
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 146 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0
* Feature equivalent of v0.0.9
* Enabled null-safety

## 0.0.9
* Fix sendSms Future never completes.

Expand Down
10 changes: 4 additions & 6 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ enum SmsStatus { STATUS_COMPLETE, STATUS_FAILED, STATUS_NONE, STATUS_PENDING }
enum DataState { DISCONNECTED, CONNECTING, CONNECTED, SUSPENDED, UNKNOWN }

/// Represents state of cellular calls.
enum CallState { IDLE, RINGING, OFFHOOK }
enum CallState { IDLE, RINGING, OFFHOOK, UNKNOWN }

/// Represents state of cellular network data activity.
enum DataActivity { NONE, IN, OUT, INOUT, DORMANT }
enum DataActivity { NONE, IN, OUT, INOUT, DORMANT, UNKNOWN }

/// Represents types of networks for a device.
enum NetworkType {
Expand Down Expand Up @@ -202,7 +202,7 @@ enum NetworkType {
}

/// Represents types of cellular technology supported by a device.
enum PhoneType { NONE, GSM, CDMA, SIP }
enum PhoneType { NONE, GSM, CDMA, SIP, UNKNOWN }

/// Represents state of SIM.
enum SimState {
Expand All @@ -221,7 +221,7 @@ enum SimState {
}

/// Represents state of cellular service.
enum ServiceState { IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF }
enum ServiceState { IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF, UNKNOWN }

/// Represents the quality of cellular signal.
enum SignalStrength { NONE_OR_UNKNOWN, POOR, MODERATE, GOOD, GREAT }
Expand All @@ -234,11 +234,9 @@ extension Value on Sort {
switch (this) {
case Sort.ASC:
return "ASC";
break;
case Sort.DESC:
default:
return "DESC";
break;
}
}
}
Expand Down
26 changes: 8 additions & 18 deletions lib/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class ConversationFilter

abstract class FilterStatement<T extends Filter, K> {
String _column;
String _previousFilter;
List<String> _previousFilterArgs;
String _previousFilter = "";
List<String> _previousFilterArgs = [];

FilterStatement._(this._column);

Expand Down Expand Up @@ -167,12 +167,8 @@ class SmsFilterStatement

@override
SmsFilter _createFilter(String value, String operator) {
if (_previousFilter != null) {
return SmsFilter._("$_previousFilter $_column $operator ?",
_previousFilterArgs..add(value));
} else {
return SmsFilter._("$_column $operator ?", [value]);
}
return SmsFilter._("$_previousFilter $_column $operator ?",
_previousFilterArgs..add(value));
}
}

Expand All @@ -186,12 +182,8 @@ class ConversationFilterStatement

@override
ConversationFilter _createFilter(String value, String operator) {
if (_previousFilter != null) {
return ConversationFilter._("$_previousFilter $_column $operator ?",
_previousFilterArgs..add(value));
} else {
return ConversationFilter._("$_column $operator ?", [value]);
}
return ConversationFilter._("$_previousFilter $_column $operator ?",
_previousFilterArgs..add(value));
}
}

Expand All @@ -200,10 +192,8 @@ class OrderBy {
Sort _sort = Sort.DESC;

/// Orders the query results by the provided column and [sort] value.
OrderBy(this._column, {Sort sort}) {
if (sort != null) {
_sort = sort;
}
OrderBy(this._column, {Sort sort = Sort.DESC}) {
_sort = sort;
}

String get _value => "${_column._name} ${_sort.value}";
Expand Down
Loading

0 comments on commit 5620bf4

Please sign in to comment.