Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(repo): upgrade to flutter 3.0 #1141

Merged
merged 5 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts/remove-from-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Fast fail the script on failures.
set -e

pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
2 changes: 1 addition & 1 deletion .github/workflows/stream_flutter_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- name: "Install Tools"
run: |
flutter pub global activate melos ${{ env.melos_version }}
pub global activate remove_from_coverage
flutter pub global activate remove_from_coverage
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Flutter Test"
Expand Down
16 changes: 16 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ linter:
- tighten_type_of_initializing_formals
- null_check_on_nullable_type_parameter

- conditional_uri_does_not_exist
- secure_pubspec_urls
- sized_box_shrink_expand
- unnecessary_constructor_name
- unnecessary_late
- use_colored_box
- use_decorated_box
- use_enums
- use_super_parameters
- avoid_escaping_inner_quotes
- unnecessary_overrides
- prefer_null_aware_method_calls
- prefer_null_aware_operators
- use_named_constants
- use_raw_strings

# https://dartcodemetrics.dev/docs/getting-started/introduction
dart_code_metrics:
rules:
Expand Down
Empty file removed melos
Empty file.
15 changes: 13 additions & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: stream_chat_flutter
repository: https://github.com/GetStream/stream-chat-flutter

versioning:
mode: independent
Expand All @@ -7,6 +8,10 @@ packages:
- packages/**

scripts:
postclean:
run: melos run clean:flutter --no-select
description: Runs "flutter clean" in all Flutter packages

lint:all:
run: melos run analyze && melos run format
description: Run all static analysis checks
Expand Down Expand Up @@ -74,6 +79,12 @@ scripts:
flutter: true
dir-exists: test

clean:flutter:
run: melos exec -c 4 --fail-fast -- "flutter clean"
description: Run Flutter clean for a specific package in this project.
select-package:
flutter: true

coverage:ignore-file:
run: |
melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh"
Expand All @@ -91,5 +102,5 @@ dev_dependencies:
dart_code_metrics: ^4.4.0

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: '>=1.17.0 <2.0.0'
sdk: '>=2.17.0 <3.0.0'
flutter: '>=1.17.0 <3.0.0'
12 changes: 6 additions & 6 deletions packages/stream_chat/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class StreamExample extends StatelessWidget {
/// To initialize this example, an instance of
/// [client] and [channel] is required.
const StreamExample({
Key? key,
super.key,
required this.client,
required this.channel,
}) : super(key: key);
});

/// Instance of [StreamChatClient] we created earlier.
/// This contains information about our application and connection state.
Expand All @@ -67,9 +67,9 @@ class StreamExample extends StatelessWidget {
class HomeScreen extends StatelessWidget {
/// [HomeScreen] is constructed using the [Channel] we defined earlier.
const HomeScreen({
Key? key,
super.key,
required this.channel,
}) : super(key: key);
});

/// Channel object containing the [Channel.id] we'd like to observe.
final Channel channel;
Expand Down Expand Up @@ -119,10 +119,10 @@ class HomeScreen extends StatelessWidget {
class MessageView extends StatefulWidget {
/// Message takes the latest list of messages and the current channel.
const MessageView({
Key? key,
super.key,
required this.messages,
required this.channel,
}) : super(key: key);
});

/// List of messages sent in the given channel.
final List<Message> messages;
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ publish_to: "none"
version: 1.0.0+1

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'

dependencies:
cupertino_icons: ^1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/stream_chat/lib/src/client/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ class ChannelClientState {

/// The channel threads related to this channel.
Map<String, List<Message>> get threads =>
_threadsController.value.map((key, value) => MapEntry(key, value));
_threadsController.value.map(MapEntry.new);

/// The channel threads related to this channel as a stream.
Stream<Map<String, List<Message>>> get threadsStream =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class StreamChatError with EquatableMixin implements Exception {
class StreamWebSocketError extends StreamChatError {
///
const StreamWebSocketError(
String message, {
super.message, {
this.data,
}) : super(message);
});

///
factory StreamWebSocketError.fromStreamError(Map<String, Object?> error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ class StreamChatDioError extends DioError {
/// Initialize a stream chat dio error
StreamChatDioError({
required this.error,
required RequestOptions requestOptions,
Response? response,
DioErrorType type = DioErrorType.other,
required super.requestOptions,
super.response,
super.type,
}) : super(
error: error,
requestOptions: requestOptions,
response: response,
type: type,
);

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,21 @@ class _$UploadStateCopyWithImpl<$Res> implements $UploadStateCopyWith<$Res> {
}

/// @nodoc
abstract class $PreparingCopyWith<$Res> {
factory $PreparingCopyWith(Preparing value, $Res Function(Preparing) then) =
_$PreparingCopyWithImpl<$Res>;
abstract class _$$PreparingCopyWith<$Res> {
factory _$$PreparingCopyWith(
_$Preparing value, $Res Function(_$Preparing) then) =
__$$PreparingCopyWithImpl<$Res>;
}

/// @nodoc
class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $PreparingCopyWith<$Res> {
_$PreparingCopyWithImpl(Preparing _value, $Res Function(Preparing) _then)
: super(_value, (v) => _then(v as Preparing));
class __$$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$PreparingCopyWith<$Res> {
__$$PreparingCopyWithImpl(
_$Preparing _value, $Res Function(_$Preparing) _then)
: super(_value, (v) => _then(v as _$Preparing));

@override
Preparing get _value => super._value as Preparing;
_$Preparing get _value => super._value as _$Preparing;
}

/// @nodoc
Expand All @@ -137,7 +139,7 @@ class _$Preparing implements Preparing {
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is Preparing);
(other.runtimeType == runtimeType && other is _$Preparing);
}

@JsonKey(ignore: true)
Expand Down Expand Up @@ -231,28 +233,29 @@ abstract class Preparing implements UploadState {
}

/// @nodoc
abstract class $InProgressCopyWith<$Res> {
factory $InProgressCopyWith(
InProgress value, $Res Function(InProgress) then) =
_$InProgressCopyWithImpl<$Res>;
abstract class _$$InProgressCopyWith<$Res> {
factory _$$InProgressCopyWith(
_$InProgress value, $Res Function(_$InProgress) then) =
__$$InProgressCopyWithImpl<$Res>;
$Res call({int uploaded, int total});
}

/// @nodoc
class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $InProgressCopyWith<$Res> {
_$InProgressCopyWithImpl(InProgress _value, $Res Function(InProgress) _then)
: super(_value, (v) => _then(v as InProgress));
class __$$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$InProgressCopyWith<$Res> {
__$$InProgressCopyWithImpl(
_$InProgress _value, $Res Function(_$InProgress) _then)
: super(_value, (v) => _then(v as _$InProgress));

@override
InProgress get _value => super._value as InProgress;
_$InProgress get _value => super._value as _$InProgress;

@override
$Res call({
Object? uploaded = freezed,
Object? total = freezed,
}) {
return _then(InProgress(
return _then(_$InProgress(
uploaded: uploaded == freezed
? _value.uploaded
: uploaded // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -292,7 +295,7 @@ class _$InProgress implements InProgress {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is InProgress &&
other is _$InProgress &&
const DeepCollectionEquality().equals(other.uploaded, uploaded) &&
const DeepCollectionEquality().equals(other.total, total));
}
Expand All @@ -306,8 +309,8 @@ class _$InProgress implements InProgress {

@JsonKey(ignore: true)
@override
$InProgressCopyWith<InProgress> get copyWith =>
_$InProgressCopyWithImpl<InProgress>(this, _$identity);
_$$InProgressCopyWith<_$InProgress> get copyWith =>
__$$InProgressCopyWithImpl<_$InProgress>(this, _$identity);

@override
@optionalTypeArgs
Expand Down Expand Up @@ -399,24 +402,24 @@ abstract class InProgress implements UploadState {
int get uploaded => throw _privateConstructorUsedError;
int get total => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$InProgressCopyWith<InProgress> get copyWith =>
_$$InProgressCopyWith<_$InProgress> get copyWith =>
throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $SuccessCopyWith<$Res> {
factory $SuccessCopyWith(Success value, $Res Function(Success) then) =
_$SuccessCopyWithImpl<$Res>;
abstract class _$$SuccessCopyWith<$Res> {
factory _$$SuccessCopyWith(_$Success value, $Res Function(_$Success) then) =
__$$SuccessCopyWithImpl<$Res>;
}

/// @nodoc
class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $SuccessCopyWith<$Res> {
_$SuccessCopyWithImpl(Success _value, $Res Function(Success) _then)
: super(_value, (v) => _then(v as Success));
class __$$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$SuccessCopyWith<$Res> {
__$$SuccessCopyWithImpl(_$Success _value, $Res Function(_$Success) _then)
: super(_value, (v) => _then(v as _$Success));

@override
Success get _value => super._value as Success;
_$Success get _value => super._value as _$Success;
}

/// @nodoc
Expand All @@ -438,7 +441,7 @@ class _$Success implements Success {
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is Success);
(other.runtimeType == runtimeType && other is _$Success);
}

@JsonKey(ignore: true)
Expand Down Expand Up @@ -532,26 +535,26 @@ abstract class Success implements UploadState {
}

/// @nodoc
abstract class $FailedCopyWith<$Res> {
factory $FailedCopyWith(Failed value, $Res Function(Failed) then) =
_$FailedCopyWithImpl<$Res>;
abstract class _$$FailedCopyWith<$Res> {
factory _$$FailedCopyWith(_$Failed value, $Res Function(_$Failed) then) =
__$$FailedCopyWithImpl<$Res>;
$Res call({String error});
}

/// @nodoc
class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements $FailedCopyWith<$Res> {
_$FailedCopyWithImpl(Failed _value, $Res Function(Failed) _then)
: super(_value, (v) => _then(v as Failed));
class __$$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
implements _$$FailedCopyWith<$Res> {
__$$FailedCopyWithImpl(_$Failed _value, $Res Function(_$Failed) _then)
: super(_value, (v) => _then(v as _$Failed));

@override
Failed get _value => super._value as Failed;
_$Failed get _value => super._value as _$Failed;

@override
$Res call({
Object? error = freezed,
}) {
return _then(Failed(
return _then(_$Failed(
error: error == freezed
? _value.error
: error // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -584,7 +587,7 @@ class _$Failed implements Failed {
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is Failed &&
other is _$Failed &&
const DeepCollectionEquality().equals(other.error, error));
}

Expand All @@ -595,8 +598,8 @@ class _$Failed implements Failed {

@JsonKey(ignore: true)
@override
$FailedCopyWith<Failed> get copyWith =>
_$FailedCopyWithImpl<Failed>(this, _$identity);
_$$FailedCopyWith<_$Failed> get copyWith =>
__$$FailedCopyWithImpl<_$Failed>(this, _$identity);

@override
@optionalTypeArgs
Expand Down Expand Up @@ -685,5 +688,6 @@ abstract class Failed implements UploadState {

String get error => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$FailedCopyWith<Failed> get copyWith => throw _privateConstructorUsedError;
_$$FailedCopyWith<_$Failed> get copyWith =>
throw _privateConstructorUsedError;
}
Loading