Skip to content

Commit

Permalink
flutter upgrade 3.22.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik committed Aug 28, 2024
1 parent 57208be commit ee11429
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 27 deletions.
1 change: 1 addition & 0 deletions packages/stream_feed/lib/src/client/analytics_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:stream_feed/src/core/util/token_helper.dart';
/// - Viewing another user's profile page
/// - Searching for a certain user/content/topic/etc.
/// {@endtemplate}
// ignore: must_be_immutable
class StreamAnalytics extends Equatable {
/// [StreamAnalytics] constructor:
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class BatchOperationsClient {
final token = TokenHelper.buildFollowToken(secret, TokenAction.write);
return _batch.unfollowMany(
token,
unfollows.map((e) => UnFollowRelation.fromFollow(e, keepHistory)),
unfollows
.map((e) => UnFollowRelation.fromFollow(e, keepHistory: keepHistory)),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:stream_feed/src/core/util/token_helper.dart';
/// learning to optimize what's shown in the feed.
///
/// The 5 most common use cases are:
// ignore: doc_directive_unknown
/// {@image <image alt='' src='https://getstream.imgix.net/images/docs/[email protected]?cs=strip&auto=format,compress?auto=compress,auto&fit=clip&h=600&w=800'>}
///
/// Famous examples of discovery feeds are Instagram's explore section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import 'package:dio/dio.dart';
import 'package:stream_feed/src/core/error/stream_feeds_error.dart';

/// Error class specific to StreamFeed and Dio
class StreamFeedsDioError extends DioError {
class StreamFeedsDioError extends DioException {
/// Initialize a stream feed dio error
StreamFeedsDioError({
required this.error,
required RequestOptions requestOptions,
Response? response,
DioErrorType type = DioErrorType.other,
DioExceptionType type = DioExceptionType.unknown,
}) : super(
error: error,
requestOptions: requestOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class StreamFeedsNetworkError extends StreamFeedsError {
this.data,
}) : super(message);

/// Builds a [StreamFeedsNetworkError] from a [DioError].
factory StreamFeedsNetworkError.fromDioError(DioError error) {
/// Builds a [StreamFeedsNetworkError] from a [DioException].
factory StreamFeedsNetworkError.fromDioError(DioException error) {
final response = error.response;
ErrorResponse? errorResponse;
final data = json.decode(response?.data);
Expand All @@ -49,7 +49,7 @@ class StreamFeedsNetworkError extends StreamFeedsError {
return StreamFeedsNetworkError.raw(
code: errorResponse?.code ?? -1,
message:
errorResponse?.message ?? response?.statusMessage ?? error.message,
errorResponse?.message ?? response?.statusMessage ?? error.message!,
statusCode: errorResponse?.statusCode ?? response?.statusCode,
data: errorResponse,
)..stackTrace = error.stackTrace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ class LoggingInterceptor extends Interceptor {
}

@override
void onError(DioError err, ErrorInterceptorHandler handler) {
void onError(DioException err, ErrorInterceptorHandler handler) {
if (error) {
if (err.type == DioErrorType.response) {
if (err.type == DioExceptionType.unknown) {
final uri = err.response?.requestOptions.uri;
_printBoxed(
_logPrintError,
Expand Down
18 changes: 9 additions & 9 deletions packages/stream_feed/lib/src/core/http/stream_http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class StreamHttpClient {
}) : options = options ?? const StreamHttpClientOptions(),
httpClient = dio ?? Dio() {
httpClient
..options.receiveTimeout = this.options.receiveTimeout.inMilliseconds
..options.connectTimeout = this.options.connectTimeout.inMilliseconds
..options.receiveTimeout = this.options.receiveTimeout
..options.connectTimeout = this.options.connectTimeout
..options.queryParameters = {
'api_key': apiKey,
'location': this.options.group,
Expand Down Expand Up @@ -70,7 +70,7 @@ class StreamHttpClient {
@visibleForTesting
final Dio httpClient;

StreamFeedsNetworkError _parseError(DioError err) {
StreamFeedsNetworkError _parseError(DioException err) {
StreamFeedsNetworkError error;
// locally thrown dio error
if (err is StreamFeedsDioError) {
Expand Down Expand Up @@ -100,7 +100,7 @@ class StreamHttpClient {
options: Options(headers: headers?.nullProtected),
);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand All @@ -125,7 +125,7 @@ class StreamHttpClient {
onReceiveProgress: onReceiveProgress,
cancelToken: cancelToken);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand All @@ -144,7 +144,7 @@ class StreamHttpClient {
options: Options(headers: headers?.nullProtected),
);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand All @@ -165,7 +165,7 @@ class StreamHttpClient {
options: Options(headers: headers?.nullProtected),
);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand All @@ -186,7 +186,7 @@ class StreamHttpClient {
options: Options(headers: headers?.nullProtected),
);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand All @@ -210,7 +210,7 @@ class StreamHttpClient {
onReceiveProgress: onReceiveProgress,
cancelToken: cancelToken);
return response;
} on DioError catch (error) {
} on DioException catch (error) {
throw _parseError(error);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/stream_feed/lib/src/core/models/follow_relation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class UnFollowRelation extends FollowRelation {
_$UnFollowRelationFromJson(json);

/// Builds an [UnFollowRelation] from a Follow.
factory UnFollowRelation.fromFollow(
FollowRelation follow, bool? keepHistory) =>
factory UnFollowRelation.fromFollow(FollowRelation follow,
{bool? keepHistory}) =>
UnFollowRelation(
source: follow.source,
target: follow.target,
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_feed/lib/src/core/util/serializer.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Used to avoid to serialize properties to json
Null readonly(_) => null;
dynamic readonly(_) => null;

/// Helper class for serialization to and from json
class Serializer {
Expand Down
8 changes: 4 additions & 4 deletions packages/stream_feed/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ repository: https://github.com/GetStream/stream-feed-flutter
issue_tracker: https://github.com/GetStream/stream-feed-flutter/issues
homepage: https://getstream.io/
environment:
sdk: ">=2.14.0 <3.0.0"
sdk: ">=3.3.0 <4.0.0"

dependencies:
collection: ^1.15.0
dio: ^4.0.0
dio: ^5.6.0
equatable: ^2.0.0
faye_dart: ^0.1.1+2
http_parser: ^4.0.0
intl: ^0.17.0
intl: ^0.19.0
jose: ^0.3.2
json_annotation: ^4.4.0
logging: ^1.0.1
Expand All @@ -24,7 +24,7 @@ dependencies:
dev_dependencies:
build_runner: ^2.0.2
json_serializable: ^6.1.5
mocktail: ^0.3.0
mocktail: ^1.0.4
test: ^1.17.3
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
5 changes: 3 additions & 2 deletions packages/stream_feed/test/models_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,8 @@ void main() {

test('fromFollow', () {
const follow = FollowRelation(source: 'feedId', target: 'targetId');
final unfollowFromFollow = UnFollowRelation.fromFollow(follow, true);
final unfollowFromFollow =
UnFollowRelation.fromFollow(follow, keepHistory: true);
expect(unfollowFromFollow, unfollow);
});

Expand Down Expand Up @@ -1288,7 +1289,7 @@ void main() {
const size = 0;

test('should throw if `path` or `bytes` is not provided', () {
expect(() => AttachmentFile(), throwsA(isA<AssertionError>()));
expect(AttachmentFile.new, throwsA(isA<AssertionError>()));
});

test('toJson', () {
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_feed/test/stream_feeds_error_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main() {
statusCode: statusCode,
);

final dioError = DioError(
final dioError = DioException(
requestOptions: options,
response: Response(
requestOptions: options,
Expand Down

0 comments on commit ee11429

Please sign in to comment.