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 5 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.

6 changes: 3 additions & 3 deletions flutter_cache_manager/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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({Key? key}) : super(key: key);

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

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

void _downloadFile() {
setState(() {
Expand All @@ -50,7 +50,7 @@ class _CacheManagerPageState extends State<CacheManagerPage> {
);
}
return DownloadPage(
fileStream: fileStream,
fileStream: fileStream!,
downloadFile: _downloadFile,
clearCache: _clearCache,
removeFile: _removeFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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,
Key? key,
required this.fileStream,
this.downloadFile,
this.clearCache,
this.removeFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ 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 VoidCallback? clearCache;
final VoidCallback? removeFile;

const FileInfoWidget({
Key key,
this.fileInfo,
Key? key,
required this.fileInfo,
this.clearCache,
this.removeFile,
}) : super(key: key);
Expand Down Expand Up @@ -38,15 +38,15 @@ class FileInfoWidget extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(10.0),
// ignore: deprecated_member_use
child: RaisedButton(
child: ElevatedButton(
child: const Text('CLEAR CACHE'),
onPressed: clearCache,
),
),
Padding(
padding: const EdgeInsets.all(10.0),
// ignore: deprecated_member_use
child: RaisedButton(
child: ElevatedButton(
child: const Text('REMOVE FILE'),
onPressed: removeFile,
),
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({Key? key, this.downloadFile}) : super(key: key);

@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({Key? key, this.progress}) : super(key: key);

@override
Widget build(BuildContext context) {
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
10 changes: 5 additions & 5 deletions flutter_cache_manager/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ publish_to: none
version: 1.0.0+1

environment:
sdk: ">=2.10.2 <3.0.0"
sdk: ">=3.0.0 <4.0.0"
Carapacik marked this conversation as resolved.
Show resolved Hide resolved

dependencies:
baseflow_plugin_template:
git:
url: https://github.com/Baseflow/baseflow_plugin_template.git
ref: v1.0.0
cupertino_icons: ^1.0.2
ref: v2.1.0
cupertino_icons: ^1.0.5
flutter:
sdk: flutter
flutter_cache_manager:
path: ../
url_launcher: ^5.4.11
url_launcher: ^6.1.11

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.4
flutter_lints: ^2.0.1


# The following section is specific to Flutter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_windows/url_launcher_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
)

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}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
2 changes: 1 addition & 1 deletion flutter_cache_manager/lib/src/cache_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';
import 'dart:typed_data';

import 'package:file/file.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/foundation.dart' show visibleForTesting;
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_cache_manager/src/cache_store.dart';
import 'package:flutter_cache_manager/src/storage/cache_object.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class DefaultCacheManager extends CacheManager with ImageCacheManager {
static const key = 'libCachedImageData';

static final DefaultCacheManager _instance = DefaultCacheManager._();

factory DefaultCacheManager() {
return _instance;
}
Expand Down
6 changes: 4 additions & 2 deletions flutter_cache_manager/lib/src/cache_store.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:async';

import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart';

import '../flutter_cache_manager.dart';
import '../src/storage/file_system/file_system.dart';
import 'storage/cache_object.dart';

///Flutter Cache Manager
Expand All @@ -18,9 +17,12 @@ class CacheStore {
FileSystem fileSystem;

final Config _config;

String get storeKey => _config.cacheKey;
final Future<CacheInfoRepository> _cacheInfoRepository;

int get _capacity => _config.maxNrOfCacheObjects;

Duration get _maxAge => _config.stalePeriod;

DateTime lastCleanupRun = DateTime.now();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import '../web/mime_converter.dart';

class FileServiceCompat extends FileService {
final FileFetcher fileFetcher;

FileServiceCompat(this.fileFetcher);

@override
Expand Down
5 changes: 5 additions & 0 deletions flutter_cache_manager/lib/src/config/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ abstract class Config {
}) = impl.Config;

String get cacheKey;

Duration get stalePeriod;

int get maxNrOfCacheObjects;

CacheInfoRepository get repo;

FileSystem get fileSystem;

FileService get fileService;
}
Loading