remove unwanted dependencies
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
targets:
|
||||
$default:
|
||||
builders:
|
||||
moor_generator:
|
||||
options:
|
||||
generate_connect_constructor: true
|
||||
json_serializable:
|
||||
options:
|
||||
explicit_to_json: true
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../exceptions.dart';
|
||||
|
||||
part 'result.freezed.dart';
|
||||
|
||||
///
|
||||
@freezed
|
||||
abstract class Result<T> with _$Result<T> {
|
||||
///
|
||||
const factory Result.success({@required T data}) = Success<T>;
|
||||
|
||||
///
|
||||
const factory Result.error({@required ApiError error}) = Error<T>;
|
||||
}
|
||||
|
||||
///
|
||||
extension ResultX<T> on Result<T> {
|
||||
///
|
||||
bool get isSuccess => this is Success<T>;
|
||||
|
||||
///
|
||||
bool get isError => this is Error<T>;
|
||||
|
||||
///
|
||||
T get data {
|
||||
if (isError) {
|
||||
throw Exception(
|
||||
'Result is not successful. Check result.isSuccess before reading the data.',
|
||||
);
|
||||
}
|
||||
return (this as Success<T>).data;
|
||||
}
|
||||
|
||||
///
|
||||
ApiError get error {
|
||||
if (isSuccess) {
|
||||
throw Exception(
|
||||
'Result is successful, not an error. Check result.isError before reading the error.',
|
||||
);
|
||||
}
|
||||
return (this as Error<T>).error;
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,4 @@ export './src/models/reaction.dart';
|
||||
export './src/models/read.dart';
|
||||
export './src/models/user.dart';
|
||||
export './src/notifications.dart';
|
||||
export './src/db/stream_chat_persistence.dart';
|
||||
export './src/utils/result.dart' hide Success, Error;
|
||||
export './src/db/stream_chat_persistence.dart';
|
||||
@@ -18,11 +18,9 @@ dependencies:
|
||||
web_socket_channel: ^1.1.0
|
||||
uuid: ^2.2.2
|
||||
async: ^2.4.1
|
||||
stream_channel: ^2.0.0
|
||||
rxdart: ^0.24.1
|
||||
collection: ^1.14.12
|
||||
pedantic: ^1.9.2
|
||||
freezed: ^0.12.7
|
||||
stream_chat_persistence:
|
||||
path: ../stream_chat_persistence
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ dependencies:
|
||||
moor: ^3.4.0
|
||||
path: ^1.7.0
|
||||
path_provider: ^1.6.27
|
||||
sqlite3_flutter_libs: ^0.3.0
|
||||
stream_chat:
|
||||
path: ../dart_client
|
||||
|
||||
|
||||
Reference in New Issue
Block a user