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

Upgrade to Dart 3 to compatibility with http ^1.0.0 #414

Merged
merged 27 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
92e268e
Upgrade to Dart 3
Carapacik May 24, 2023
18e731d
Update build_runner and mockito to support latest version
Carapacik May 24, 2023
3c17344
Add changelog
Carapacik May 29, 2023
8cf0557
Format code
Carapacik Jun 2, 2023
d1dbbe6
Update path_provider to support newest xdg_directories
Carapacik Jun 2, 2023
dd0821e
Update example for latest baseflow_plugin_template
Carapacik Jun 8, 2023
6819fbc
http >=0.13.0 <2.0.0
Carapacik Jun 19, 2023
7cce7e2
rxdart dependency
Carapacik Jun 19, 2023
2624abc
Fix rxdart dependency
Carapacik Jun 19, 2023
9d97fd0
Fix for PR
Carapacik Jun 19, 2023
0d994b2
Remove unawaited to support dart 2.12
Carapacik Jun 19, 2023
cdce65f
Fixes for analyzer
Carapacik Jun 19, 2023
3e6a6bb
Update example
Carapacik Jun 19, 2023
088a3e0
Downgrade collection lower bound and support for uuid 4.0.0
Carapacik Jun 20, 2023
9f84b5b
Add type annotations
Carapacik Jun 20, 2023
8f5e260
clock back to 1.1.0 for support dart 2.12
Carapacik Jun 22, 2023
24988ac
Update github actions versions
Carapacik Jun 23, 2023
bfa3202
Add topics
Carapacik Jul 1, 2023
f40e897
Format tests and update build_runner to ^2.0.0
Carapacik Jul 1, 2023
8f31ea2
Fix android build with github actions
Carapacik Jul 2, 2023
cf35001
Fix link in example assets
Carapacik Jul 2, 2023
32051dc
Remove unused assets
renefloor Jul 3, 2023
c8a087a
remove empty assets list
renefloor Jul 3, 2023
7d34e34
Fix null reference bug
renefloor Jul 3, 2023
0c73ad3
Remove unused assets
Carapacik Jul 3, 2023
07174f6
Update minimal dart sdk version
renefloor Jul 3, 2023
06dbb27
Update example
Carapacik Jul 3, 2023
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
83 changes: 16 additions & 67 deletions flutter_cache_manager/.gitignore
Original file line number Diff line number Diff line change
@@ -1,95 +1,44 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.project
.svn/
bin/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Android Studio related
android/.classpath
android/.settings/

# Visual Studio Code related
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/docs/doc/
/dev/docs/lib/
/dev/docs/pubspec.yaml
/packages/flutter/coverage/
version
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds
flutter_export_environment.sh
/build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# Symbolication related
app.*.symbols

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Obfuscation related
app.*.map.json

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
example/.flutter-plugins-dependencies
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
3 changes: 3 additions & 0 deletions flutter_cache_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [3.4.0] - 2023-05-29
* Require Dart ^3.0.0 (for http ^1.0.0)

Carapacik marked this conversation as resolved.
Show resolved Hide resolved
## [3.3.0] - 2021-11-29
* Added option to manage the log level. Doesn't print failed downloads by default anymore. You can set it like this:
```dart
Expand Down
16 changes: 0 additions & 16 deletions flutter_cache_manager/example/lib/generated_plugin_registrant.dart

This file was deleted.

24 changes: 13 additions & 11 deletions flutter_cache_manager/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

void main() {
runApp(BaseflowPluginExample(
pluginName: 'Flutter Cache Manager',
githubURL: 'https://github.com/Baseflow/flutter_cache_manager',
pubDevURL: 'https://pub.dev/packages/flutter_cache_manager',
pages: [CacheManagerPage.createPage()],
));
runApp(
BaseflowPluginExample(
pluginName: 'Flutter Cache Manager',
githubURL: 'https://github.com/Baseflow/flutter_cache_manager',
pubDevURL: 'https://pub.dev/packages/flutter_cache_manager',
pages: [CacheManagerPage.createPage()],
),
);
CacheManager.logLevel = CacheManagerLogLevel.verbose;
}

const url = 'https://blurha.sh/assets/images/img1.jpg';

/// Example [Widget] showing the functionalities of flutter_cache_manager
class CacheManagerPage extends StatefulWidget {
const CacheManagerPage({Key key}) : super(key: key);
const CacheManagerPage({super.key});

static ExamplePage createPage() {
return ExamplePage(Icons.save_alt, (context) => const CacheManagerPage());
Expand All @@ -29,7 +31,7 @@ class CacheManagerPage extends StatefulWidget {
}

class _CacheManagerPageState extends State<CacheManagerPage> {
Stream<FileResponse> fileStream;
Stream<FileResponse>? fileStream;

void _downloadFile() {
setState(() {
Expand All @@ -41,16 +43,16 @@ class _CacheManagerPageState extends State<CacheManagerPage> {
Widget build(BuildContext context) {
if (fileStream == null) {
return Scaffold(
appBar: null,
body: const ListTile(
title: Text('Tap the floating action button to download.')),
title: Text('Tap the floating action button to download.'),
),
floatingActionButton: Fab(
downloadFile: _downloadFile,
),
);
}
return DownloadPage(
fileStream: fileStream,
fileStream: fileStream!,
downloadFile: _downloadFile,
clearCache: _clearCache,
removeFile: _removeFile,
Expand Down
20 changes: 10 additions & 10 deletions flutter_cache_manager/example/lib/plugin_example/download_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import 'progress_indicator.dart' as p_i;
/// A [Widget] showing the information about the status of the [FileResponse]
class DownloadPage extends StatelessWidget {
final Stream<FileResponse> fileStream;
final VoidCallback downloadFile;
final VoidCallback clearCache;
final VoidCallback removeFile;
final VoidCallback? downloadFile;
final VoidCallback? clearCache;
final VoidCallback? removeFile;
Carapacik marked this conversation as resolved.
Show resolved Hide resolved

const DownloadPage({
Key key,
this.fileStream,
super.key,
required this.fileStream,
this.downloadFile,
this.clearCache,
this.removeFile,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand All @@ -27,7 +27,7 @@ class DownloadPage extends StatelessWidget {
builder: (context, snapshot) {
Widget body;

var loading = !snapshot.hasData || snapshot.data is DownloadProgress;
final loading = !snapshot.hasData || snapshot.data is DownloadProgress;

if (snapshot.hasError) {
body = ListTile(
Expand All @@ -36,17 +36,17 @@ class DownloadPage extends StatelessWidget {
);
} else if (loading) {
body = p_i.ProgressIndicator(
progress: snapshot.data as DownloadProgress);
progress: snapshot.data as DownloadProgress,
);
} else {
body = FileInfoWidget(
fileInfo: snapshot.data as FileInfo,
fileInfo: snapshot.requireData as FileInfo,
clearCache: clearCache,
removeFile: removeFile,
);
}

return Scaffold(
appBar: null,
body: body,
floatingActionButton: !loading
? Fab(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';

/// A [Widget] showing all available information about the downloaded file
class FileInfoWidget extends StatelessWidget {
final FileInfo fileInfo;
final VoidCallback clearCache;
final VoidCallback removeFile;
final FileInfo? fileInfo;
final VoidCallback? clearCache;
final VoidCallback? removeFile;

const FileInfoWidget({
Key key,
super.key,
this.fileInfo,
this.clearCache,
this.removeFile,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
return ListView(
children: <Widget>[
ListTile(
title: const Text('Original URL'),
subtitle: Text(fileInfo.originalUrl),
subtitle: Text(fileInfo?.originalUrl ?? ''),
),
if (fileInfo.file != null)
if (fileInfo?.file != null)
ListTile(
title: const Text('Local file path'),
subtitle: Text(fileInfo.file.path),
subtitle: Text(fileInfo?.file.path ?? ''),
),
ListTile(
title: const Text('Loaded from'),
subtitle: Text(fileInfo.source.toString()),
subtitle: Text(fileInfo?.source.toString() ?? ''),
),
ListTile(
title: const Text('Valid Until'),
subtitle: Text(fileInfo.validTill.toIso8601String()),
subtitle: Text(fileInfo?.validTill.toIso8601String() ?? ''),
),
Padding(
padding: const EdgeInsets.all(10.0),
padding: const EdgeInsets.all(10),
// ignore: deprecated_member_use
child: RaisedButton(
child: const Text('CLEAR CACHE'),
child: ElevatedButton(
onPressed: clearCache,
child: const Text('CLEAR CACHE'),
),
),
Padding(
padding: const EdgeInsets.all(10.0),
padding: const EdgeInsets.all(10),
// ignore: deprecated_member_use
child: RaisedButton(
child: const Text('REMOVE FILE'),
child: ElevatedButton(
onPressed: removeFile,
child: const Text('REMOVE FILE'),
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import 'package:flutter/material.dart';

/// A [FloatingActionButton] used for downloading a file in [CacheManagerPage]
class Fab extends StatelessWidget {
final VoidCallback downloadFile;
const Fab({Key key, this.downloadFile}) : super(key: key);
final VoidCallback? downloadFile;

const Fab({super.key, this.downloadFile});

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';
/// A centered and sized [CircularProgressIndicator] to show download progress
/// in the [DownloadPage].
class ProgressIndicator extends StatelessWidget {
final DownloadProgress progress;
final DownloadProgress? progress;

const ProgressIndicator({Key key, this.progress}) : super(key: key);
const ProgressIndicator({super.key, this.progress});

@override
Widget build(BuildContext context) {
Expand All @@ -15,13 +15,13 @@ class ProgressIndicator extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
width: 50.0,
height: 50.0,
width: 50,
height: 50,
child: CircularProgressIndicator(
value: progress?.progress,
),
),
const SizedBox(width: 20.0),
const SizedBox(width: 20),
const Text('Downloading'),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
Expand All @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FlutterMacOS
import Foundation

import path_provider_macos
import path_provider_foundation
import sqflite
import url_launcher_macos

Expand Down
Loading