File tree Expand file tree Collapse file tree 3 files changed +20
-12
lines changed
Expand file tree Collapse file tree 3 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,5 @@ dependencies:
1111
1212dev_dependencies :
1313 dart_flutter_team_lints : ^3.5.2
14+ os_detect : ^2.0.3
1415 test : ^1.24.0
Original file line number Diff line number Diff line change 33// BSD-style license that can be found in the LICENSE file.
44
55import 'dart:convert' ;
6- import 'dart:io' ;
76import 'dart:typed_data' ;
87
98import 'package:gzip/gzip.dart' ;
@@ -36,14 +35,6 @@ void main() {
3635 }
3736}
3837
39- final osHeader = Platform .isLinux
40- ? 3
41- : Platform .isMacOS
42- ? 19
43- : Platform .isWindows
44- ? 10
45- : - 1 ;
46-
4738final cases = [
4839 (
4940 name: 'Simple ASCII' ,
@@ -58,7 +49,7 @@ final cases = [
5849 0 ,
5950 0 ,
6051 0 ,
61- osHeader ,
52+ 3 ,
6253 243 ,
6354 72 ,
6455 205 ,
@@ -95,7 +86,7 @@ final cases = [
9586 0 ,
9687 0 ,
9788 0 ,
98- osHeader ,
89+ 3 ,
9990 1 ,
10091 55 ,
10192 0 ,
Original file line number Diff line number Diff line change 44
55import 'dart:typed_data' ;
66
7- Uint8List switchPlatformBit (List <int > input) => Uint8List .fromList (input);
7+ import 'package:os_detect/os_detect.dart' ;
8+
9+ Uint8List switchPlatformBit (List <int > input) {
10+ const osBit = 9 ;
11+ if (operatingSystemVersion.contains ('linux' )) {
12+ input[osBit] = 3 ;
13+ } else if (operatingSystemVersion.contains ('macos' )) {
14+ input[osBit] = 19 ;
15+ } else if (operatingSystemVersion.contains ('windows' )) {
16+ input[osBit] = 10 ;
17+ } else {
18+ throw UnimplementedError (
19+ 'No OS bit for platform $operatingSystemVersion found' ,
20+ );
21+ }
22+ return Uint8List .fromList (input);
23+ }
You can’t perform that action at this time.
0 commit comments