diff --git a/CHANGELOG.md b/CHANGELOG.md index 21900db..5a53fea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.6.0 +Fixing output file header for Android & migrate to null safety. + ## 0.5.5 migrate to Android X. diff --git a/README-zh_CN.md b/README-zh_CN.md index 9460d9e..d17114e 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -44,7 +44,7 @@ Flutter 录音插件 支持录音/暂停/继续/停止, 可以在录音的同时 ## 其他配置 #### iOS Deployment Target is 8.0 #### Android -- 开启AndroidX的项目: 请使用最新版本 (`0.5.x`) +- 开启AndroidX的项目: 请使用最新版本 (`0.6.x`) - 未使用AndroidX的项目: 可以使用旧版本 (`0.4.9`) ### 注意: iOS Deployment Target 是 8.0 diff --git a/README.md b/README.md index 3a286c1..6b69148 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ add `flutter_audio_recorder` to your `pubspec.yaml` ## Configuration #### iOS Deployment Target is 8.0 above #### Android -- AndroidX: use latest version (`0.5.x`) +- AndroidX: use latest version (`0.6.x`) - Legacy Android: use old version (`0.4.9`) ## Usage diff --git a/android/build.gradle b/android/build.gradle index 5ae10b1..c541d91 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,32 +1,33 @@ group 'com.zeno.flutter_audio_recorder' -version '0.5.4' +version '0.6.1' buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:8.1.2' } } rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } apply plugin: 'com.android.library' android { - compileSdkVersion 28 + compileSdkVersion 34 + namespace 'com.zeno.flutter_audio_recorder' defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } lintOptions { diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index ba5a6c2..df60651 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/android/src/main/java/com/zeno/flutter_audio_recorder/FlutterAudioRecorderPlugin.java b/android/src/main/java/com/zeno/flutter_audio_recorder/FlutterAudioRecorderPlugin.java index d576be4..ee853d4 100644 --- a/android/src/main/java/com/zeno/flutter_audio_recorder/FlutterAudioRecorderPlugin.java +++ b/android/src/main/java/com/zeno/flutter_audio_recorder/FlutterAudioRecorderPlugin.java @@ -1,12 +1,15 @@ package com.zeno.flutter_audio_recorder; +import android.app.Activity; import android.Manifest; +import android.content.Context; import android.content.pm.PackageManager; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Build.VERSION; +import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.util.Log; @@ -29,12 +32,15 @@ import io.flutter.plugin.common.PluginRegistry; import io.flutter.plugin.common.PluginRegistry.Registrar; +import io.flutter.embedding.engine.plugins.FlutterPlugin; +import io.flutter.embedding.engine.plugins.activity.*; +import io.flutter.plugin.common.BinaryMessenger; + /** FlutterAudioRecorderPlugin */ -public class FlutterAudioRecorderPlugin implements MethodCallHandler, PluginRegistry.RequestPermissionsResultListener { +public class FlutterAudioRecorderPlugin implements MethodCallHandler, PluginRegistry.RequestPermissionsResultListener, FlutterPlugin, ActivityAware { private static final String LOG_NAME = "AndroidAudioRecorder"; private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 200; private static final byte RECORDER_BPP = 16; // we use 16bit - private Registrar registrar; private int mSampleRate = 16000; // 16Khz private AudioRecord mRecorder = null; private String mFilePath; @@ -47,20 +53,53 @@ public class FlutterAudioRecorderPlugin implements MethodCallHandler, PluginRegi private Thread mRecordingThread = null; private long mDataSize = 0; private Result _result; - + private MethodChannel channel; + private Context context; + protected Activity activity; /** Plugin registration. */ public static void registerWith(Registrar registrar) { + final FlutterAudioRecorderPlugin plugin = new FlutterAudioRecorderPlugin(); + plugin.setupChannel(registrar.messenger(), registrar.context()); + plugin.activity = registrar.activity(); + } + + private void setupChannel(BinaryMessenger messenger, Context context) { + channel = new MethodChannel(messenger, "flutter_audio_recorder"); + channel.setMethodCallHandler(this); + this.context = context; + } + + @Override + public void onAttachedToActivity​(@NonNull ActivityPluginBinding binding) { + activity = binding.getActivity(); + } + + @Override + public void onReattachedToActivityForConfigChanges​(@NonNull ActivityPluginBinding binding){} + + @Override + public void onDetachedFromActivityForConfigChanges(){} - final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_audio_recorder"); - channel.setMethodCallHandler(new FlutterAudioRecorderPlugin(registrar)); + @Override + public void onDetachedFromActivity() { + activity = null; } - public FlutterAudioRecorderPlugin(Registrar registrar) { - this.registrar = registrar; - this.registrar.addRequestPermissionsResultListener(this); + @Override + public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { + setupChannel(binding.getBinaryMessenger(), binding.getApplicationContext()); } + @Override + public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { + channel.setMethodCallHandler(null); + channel = null; + context = null; + } + + public FlutterAudioRecorderPlugin() {} + @Override public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { final int REQUEST_RECORD_AUDIO_PERMISSION = 200; @@ -86,13 +125,7 @@ public boolean onRequestPermissionsResult(int requestCode, String[] permissions, } private boolean hasRecordPermission(){ - // if after [Marshmallow], we need to check permission on runtime - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - return (ContextCompat.checkSelfPermission(registrar.context(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) - && (ContextCompat.checkSelfPermission(registrar.context(), Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED); - } else { - return ContextCompat.checkSelfPermission(registrar.context(), Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED; - } + return ContextCompat.checkSelfPermission(context, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED; } @Override @@ -138,9 +171,9 @@ private void handleHasPermission(){ Log.d(LOG_NAME, "handleHasPermission false"); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - ActivityCompat.requestPermissions(registrar.activity(), new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_RECORD_AUDIO); + ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_RECORD_AUDIO); } else { - ActivityCompat.requestPermissions(registrar.activity(), new String[]{Manifest.permission.RECORD_AUDIO}, PERMISSIONS_REQUEST_RECORD_AUDIO); + ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.RECORD_AUDIO}, PERMISSIONS_REQUEST_RECORD_AUDIO); } } @@ -354,8 +387,13 @@ private void WriteWaveFileHeader(FileOutputStream out, long totalAudioLen, header[29] = (byte) ((byteRate >> 8) & 0xff); header[30] = (byte) ((byteRate >> 16) & 0xff); header[31] = (byte) ((byteRate >> 24) & 0xff); - header[32] = (byte) (1); // block align - header[33] = 0; + + long blockAlign = channels * (int) RECORDER_BPP / 8; + //header[32] = (byte) (1); // block align + header[32] = (byte) (blockAlign); + //header[33] = 0; + header[33] = (byte) (blockAlign >> 8); + header[34] = RECORDER_BPP; // bits per sample header[35] = 0; header[36] = 'd'; diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..f17647e --- /dev/null +++ b/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audioplayers","path":"/home/arditya/.pub-cache/hosted/pub.dev/audioplayers-0.20.1/","native_build":true,"dependencies":[]},{"name":"flutter_audio_recorder","path":"/home/arditya/Documents/dev/Me/flutter_audio_recorder/","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"/home/arditya/.pub-cache/hosted/pub.dev/path_provider_ios-2.0.7/","native_build":true,"dependencies":[]}],"android":[{"name":"audioplayers","path":"/home/arditya/.pub-cache/hosted/pub.dev/audioplayers-0.20.1/","native_build":true,"dependencies":[]},{"name":"flutter_audio_recorder","path":"/home/arditya/Documents/dev/Me/flutter_audio_recorder/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/home/arditya/.pub-cache/hosted/pub.dev/path_provider_android-2.0.11/","native_build":true,"dependencies":[]}],"macos":[{"name":"audioplayers","path":"/home/arditya/.pub-cache/hosted/pub.dev/audioplayers-0.20.1/","native_build":true,"dependencies":[]},{"name":"path_provider_macos","path":"/home/arditya/.pub-cache/hosted/pub.dev/path_provider_macos-2.0.5/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/arditya/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.5/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/home/arditya/.pub-cache/hosted/pub.dev/path_provider_windows-2.0.5/","native_build":false,"dependencies":[]}],"web":[{"name":"audioplayers","path":"/home/arditya/.pub-cache/hosted/pub.dev/audioplayers-0.20.1/","dependencies":[]}]},"dependencyGraph":[{"name":"audioplayers","dependencies":["path_provider"]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-03-16 19:02:27.631437","version":"3.16.9"} \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 093d782..1f16260 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' @@ -35,7 +35,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.zeno.flutter_audio_recorder_example" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index f8c8e17..ed0aa32 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -7,11 +7,11 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + diff --git a/example/android/app/src/main/java/com/zeno/flutter_audio_recorder_example/MainActivity.java b/example/android/app/src/main/java/com/zeno/flutter_audio_recorder_example/MainActivity.java deleted file mode 100644 index 09c7492..0000000 --- a/example/android/app/src/main/java/com/zeno/flutter_audio_recorder_example/MainActivity.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.zeno.flutter_audio_recorder_example; - -import android.os.Bundle; -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/example/android/build.gradle b/example/android/build.gradle index bb8a303..85bdcfa 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,18 +1,18 @@ buildscript { repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:4.0.1' } } allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 2819f02..f886530 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index ce9f7de..ff10f14 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,9 +1,13 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/nikk.li/Work/development/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/wenyan/zeno/project/flutter_audio_recorder/example" -export "FLUTTER_TARGET=/Users/wenyan/zeno/project/flutter_audio_recorder/example/lib/main.dart" +export "FLUTTER_ROOT=/home/arditya/flutter" +export "FLUTTER_APPLICATION_PATH=/home/arditya/Documents/dev/Me/flutter_audio_recorder/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/nikk.li/Work/development/flutter/bin/cache/artifacts/engine/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/example/lib/main.dart b/example/lib/main.dart index daf13d0..65aa29d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -5,29 +5,18 @@ import 'package:audioplayers/audioplayers.dart'; import 'package:file/file.dart'; import 'package:file/local.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_audio_recorder/flutter_audio_recorder.dart'; import 'package:path_provider/path_provider.dart'; void main() { - SystemChrome.setEnabledSystemUIOverlays([]); - return runApp(new MyApp()); + return runApp(MyApp()); } -class MyApp extends StatefulWidget { - @override - _MyAppState createState() => new _MyAppState(); -} - -class _MyAppState extends State { +class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return new MaterialApp( - home: new Scaffold( - body: SafeArea( - child: new RecorderExample(), - ), - ), + return MaterialApp( + home: RecorderExample(), ); } } @@ -39,103 +28,99 @@ class RecorderExample extends StatefulWidget { : this.localFileSystem = localFileSystem ?? LocalFileSystem(); @override - State createState() => new RecorderExampleState(); + State createState() => RecorderExampleState(); } class RecorderExampleState extends State { - FlutterAudioRecorder _recorder; - Recording _current; - RecordingStatus _currentStatus = RecordingStatus.Unset; + FlutterAudioRecorder? _recorder; + Recording? _current; + RecordingStatus? _currentStatus = RecordingStatus.Unset; @override void initState() { - // TODO: implement initState super.initState(); _init(); } @override Widget build(BuildContext context) { - return new Center( - child: new Padding( - padding: new EdgeInsets.all(8.0), - child: new Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - new Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: new FlatButton( - onPressed: () { - switch (_currentStatus) { - case RecordingStatus.Initialized: - { - _start(); - break; - } - case RecordingStatus.Recording: - { - _pause(); - break; - } - case RecordingStatus.Paused: - { - _resume(); - break; - } - case RecordingStatus.Stopped: - { - _init(); - break; - } - default: + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextButton( + onPressed: () { + switch (_currentStatus) { + case RecordingStatus.Initialized: + { + _start(); break; - } - }, - child: _buildText(_currentStatus), - color: Colors.lightBlue, - ), - ), - new FlatButton( - onPressed: - _currentStatus != RecordingStatus.Unset ? _stop : null, - child: - new Text("Stop", style: TextStyle(color: Colors.white)), - color: Colors.blueAccent.withOpacity(0.5), - ), - SizedBox( - width: 8, - ), - new FlatButton( - onPressed: onPlayAudio, - child: - new Text("Play", style: TextStyle(color: Colors.white)), - color: Colors.blueAccent.withOpacity(0.5), + } + case RecordingStatus.Recording: + { + _pause(); + break; + } + case RecordingStatus.Paused: + { + _resume(); + break; + } + case RecordingStatus.Stopped: + { + _init(); + break; + } + default: + break; + } + }, + child: _buildText(_currentStatus), ), - ], - ), - new Text("Status : $_currentStatus"), - new Text('Avg Power: ${_current?.metering?.averagePower}'), - new Text('Peak Power: ${_current?.metering?.peakPower}'), - new Text("File path of the record: ${_current?.path}"), - new Text("Format: ${_current?.audioFormat}"), - new Text( - "isMeteringEnabled: ${_current?.metering?.isMeteringEnabled}"), - new Text("Extension : ${_current?.extension}"), - new Text( - "Audio recording duration : ${_current?.duration.toString()}") - ]), + ), + TextButton( + onPressed: + _currentStatus != RecordingStatus.Unset ? _stop : null, + child: Text("Stop", style: TextStyle(color: Colors.red)), + ), + SizedBox( + width: 8, + ), + TextButton( + onPressed: onPlayAudio, + child: Text("Play", + style: TextStyle( + color: Colors.blue, + )), + ), + ], + ), + Text("Status : $_currentStatus"), + Text('Avg Power: ${_current?.metering?.averagePower}'), + Text('Peak Power: ${_current?.metering?.peakPower}'), + Text("File path of the record: ${_current?.path}"), + Text("Format: ${_current?.audioFormat}"), + Text("isMeteringEnabled: ${_current?.metering?.isMeteringEnabled}"), + Text("Extension : ${_current?.extension}"), + Text("Audio recording duration : ${_current?.duration.toString()}") + ], + ), ), ); } _init() async { try { - if (await FlutterAudioRecorder.hasPermissions) { + final hasPermission = await FlutterAudioRecorder.hasPermissions; + if (hasPermission) { String customPath = '/flutter_audio_recorder_'; - io.Directory appDocDirectory; + io.Directory? appDocDirectory; // io.Directory appDocDirectory = await getApplicationDocumentsDirectory(); if (io.Platform.isIOS) { appDocDirectory = await getApplicationDocumentsDirectory(); @@ -144,7 +129,7 @@ class RecorderExampleState extends State { } // can add extension like ".mp4" ".wav" ".m4a" ".aac" - customPath = appDocDirectory.path + + customPath = appDocDirectory!.path + customPath + DateTime.now().millisecondsSinceEpoch.toString(); @@ -154,9 +139,9 @@ class RecorderExampleState extends State { _recorder = FlutterAudioRecorder(customPath, audioFormat: AudioFormat.WAV); - await _recorder.initialized; + await _recorder!.initialized; // after initialization - var current = await _recorder.current(channel: 0); + var current = await _recorder!.current(channel: 0); print(current); // should be "Initialized", if all working fine setState(() { @@ -165,8 +150,11 @@ class RecorderExampleState extends State { print(_currentStatus); }); } else { - Scaffold.of(context).showSnackBar( - new SnackBar(content: new Text("You must accept permissions"))); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text("You must accept permissions"), + ), + ); } } catch (e) { print(e); @@ -175,23 +163,23 @@ class RecorderExampleState extends State { _start() async { try { - await _recorder.start(); - var recording = await _recorder.current(channel: 0); + await _recorder!.start(); + var recording = await _recorder!.current(channel: 0); setState(() { _current = recording; }); const tick = const Duration(milliseconds: 50); - new Timer.periodic(tick, (Timer t) async { + Timer.periodic(tick, (Timer t) async { if (_currentStatus == RecordingStatus.Stopped) { t.cancel(); } - var current = await _recorder.current(channel: 0); + var current = await _recorder!.current(channel: 0); // print(current.status); setState(() { _current = current; - _currentStatus = _current.status; + _currentStatus = _current!.status; }); }); } catch (e) { @@ -200,28 +188,28 @@ class RecorderExampleState extends State { } _resume() async { - await _recorder.resume(); + await _recorder!.resume(); setState(() {}); } _pause() async { - await _recorder.pause(); + await _recorder!.pause(); setState(() {}); } _stop() async { - var result = await _recorder.stop(); + var result = await _recorder!.stop(); print("Stop recording: ${result.path}"); print("Stop recording: ${result.duration}"); File file = widget.localFileSystem.file(result.path); print("File length: ${await file.length()}"); setState(() { _current = result; - _currentStatus = _current.status; + _currentStatus = _current!.status; }); } - Widget _buildText(RecordingStatus status) { + Widget _buildText(RecordingStatus? status) { var text = ""; switch (_currentStatus) { case RecordingStatus.Initialized: @@ -247,11 +235,11 @@ class RecorderExampleState extends State { default: break; } - return Text(text, style: TextStyle(color: Colors.white)); + return Text(text, style: TextStyle(color: Colors.red)); } void onPlayAudio() async { AudioPlayer audioPlayer = AudioPlayer(); - await audioPlayer.play(_current.path, isLocal: true); + await audioPlayer.play(_current!.path!, isLocal: true); } } diff --git a/example/pubspec.lock b/example/pubspec.lock index 88be044..ed79f41 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,58 +5,90 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.11.0" audioplayers: dependency: "direct main" description: name: audioplayers - url: "https://pub.dartlang.org" + sha256: a565e7e3e8a21a823b8cd7fed0bde1eb3796a96b373374be557adecfb511fa6b + url: "https://pub.dev" source: hosted - version: "0.13.2" + version: "0.20.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" source: hosted - version: "1.1.2" - collection: + version: "1.3.1" + clock: dependency: transitive description: - name: collection - url: "https://pub.dartlang.org" + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.14.11" - convert: + version: "1.1.1" + collection: dependency: transitive description: - name: convert - url: "https://pub.dartlang.org" + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "1.18.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + url: "https://pub.dev" + source: hosted + version: "3.0.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "35d0f481d939de0d640b3db9a7aa36a52cd22054a798a73b4f50bdad5ce12678" + url: "https://pub.dev" + source: hosted + version: "1.1.2" file: dependency: "direct main" description: name: file - url: "https://pub.dartlang.org" + sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad + url: "https://pub.dev" source: hosted - version: "5.0.10" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -68,68 +100,145 @@ packages: path: ".." relative: true source: path - version: "0.5.3" + version: "0.6.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" - intl: + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: dependency: transitive description: - name: intl - url: "https://pub.dartlang.org" + name: http + sha256: "2ed163531e071c2c6b7c659635112f24cb64ecbebf6af46b550d536c0b1aa112" + url: "https://pub.dev" source: hosted - version: "0.16.0" + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 + url: "https://pub.dev" + source: hosted + version: "4.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" + source: hosted + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.12.5" + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.10.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.8.3" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + sha256: db1cf6c3f906f50d52c18400be575f75ed620f8717f9b6d11263edd95080dfc6 + url: "https://pub.dev" source: hosted - version: "1.3.0" - pedantic: + version: "2.0.8" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: c69109bae02c6116bd8ac81319b13eb73dfae02ef74690d2a1a98c1ddd3aaefc + url: "https://pub.dev" + source: hosted + version: "2.0.11" + path_provider_ios: + dependency: transitive + description: + name: path_provider_ios + sha256: "038d0141ff5d08c60ed071eee2758b68c50c42a1c10066a1fb6c28ab32fac84c" + url: "https://pub.dev" + source: hosted + version: "2.0.7" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "1e109f4df28bd95eab71e323008b53d19c4d633bc1ab05b577518773474e9621" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_macos: dependency: transitive description: - name: pedantic - url: "https://pub.dartlang.org" + name: path_provider_macos + sha256: "0adeb313e1f2c3fc52baeeee59b0fe9c2d1f7da56fd96a9234e1702ec653a453" + url: "https://pub.dev" source: hosted - version: "1.8.0+1" + version: "2.0.5" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "3dc0d51b07f85fec3746d9f4e8d31c73bb173cafa2e763f03f8df2e8d1878882" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "366ad4e3541ea707f859e7148d4d5aba67d589d7936cee04a05c464a277eeb27" + url: "https://pub.dev" + source: hosted + version: "2.0.5" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" source: hosted - version: "2.2.1" - quiver: + version: "3.1.0" + plugin_platform_interface: dependency: transitive description: - name: quiver - url: "https://pub.dartlang.org" + name: plugin_platform_interface + sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757" + url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.1.2" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -139,65 +248,98 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.2.5" + version: "0.6.1" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" source: hosted - version: "1.1.6" + version: "1.3.0" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + sha256: "00ba1241ff12e77d8059eeb1f102b35235df01661a6110afd165ab52a0fc7714" + url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "3.0.5" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" + source: hosted + version: "0.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "9273b3769064f82a3b330d95123d7d6cabc5ecbc59497abc7191e0a43920225b" + url: "https://pub.dev" + source: hosted + version: "2.3.10" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "0186b3f2d66be9a12b0295bddcf8b6f8c0b0cc2f85c6287344e2a6366bc28457" + url: "https://pub.dev" + source: hosted + version: "0.2.0" sdks: - dart: ">=2.2.2 <3.0.0" - flutter: ">=0.1.4 <2.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" + flutter: ">=2.5.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c52486e..ee1c328 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,14 +3,14 @@ description: Demonstrates how to use the flutter_audio_recorder plugin. publish_to: 'none' environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter - path_provider: ^1.1.0 - file: ^5.0.4 - audioplayers: ^0.13.2 + path_provider: ^2.0.8 + file: ^6.1.2 + audioplayers: ^0.20.1 dev_dependencies: diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 3308be8..4f4206a 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -19,7 +19,7 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), + widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/ios/flutter_audio_recorder.podspec b/ios/flutter_audio_recorder.podspec index 4b4a9e9..685f0a3 100644 --- a/ios/flutter_audio_recorder.podspec +++ b/ios/flutter_audio_recorder.podspec @@ -3,7 +3,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_audio_recorder' - s.version = '0.5.4' + s.version = '0.6.0' s.summary = 'A new flutter plugin project.' s.description = <<-DESC A new flutter plugin project. diff --git a/lib/flutter_audio_recorder.dart b/lib/flutter_audio_recorder.dart index bdc1771..105f359 100644 --- a/lib/flutter_audio_recorder.dart +++ b/lib/flutter_audio_recorder.dart @@ -12,72 +12,84 @@ class FlutterAudioRecorder { static const String DEFAULT_EXTENSION = '.m4a'; static LocalFileSystem fs = LocalFileSystem(); - String _path; - String _extension; - Recording _recording; - int _sampleRate; - - Future _initRecorder; - Future get initialized => _initRecorder; - Recording get recording => _recording; - - FlutterAudioRecorder(String path, - {AudioFormat audioFormat, int sampleRate = 16000}) { + String? _path; + String? _extension; + Recording? _recording; + int? _sampleRate; + + Future? _initRecorder; + Future? get initialized => _initRecorder; + Recording? get recording => _recording; + + FlutterAudioRecorder( + String path, { + AudioFormat? audioFormat, + int sampleRate = 16000, + }) { _initRecorder = _init(path, audioFormat, sampleRate); } /// Initialized recorder instance - Future _init(String path, AudioFormat audioFormat, int sampleRate) async { + Future _init( + String path, + AudioFormat? audioFormat, + int sampleRate, + ) async { String extension; String extensionInPath; - if (path != null) { - // Extension(.xyz) of Path - extensionInPath = p.extension(path); - // Use AudioFormat - if (audioFormat != null) { - // .m4a != .m4a - if (_stringToAudioFormat(extensionInPath) != audioFormat) { - // use AudioOutputFormat - extension = _audioFormatToString(audioFormat); - path = p.withoutExtension(path) + extension; - } else { - extension = p.extension(path); - } + // Extension(.xyz) of Path + extensionInPath = p.extension(path); + // Use AudioFormat + if (audioFormat != null) { + // .m4a != .m4a + if (_stringToAudioFormat(extensionInPath) != audioFormat) { + // use AudioOutputFormat + extension = _audioFormatToString(audioFormat); + path = p.withoutExtension(path) + extension; } else { - // Else, Use Extension that inferred from Path - // if extension in path is valid - if (_isValidAudioFormat(extensionInPath)) { - extension = extensionInPath; - } else { - extension = DEFAULT_EXTENSION; // default value - path += extension; - } - } - File file = fs.file(path); - if (await file.exists()) { - throw new Exception("A file already exists at the path :" + path); - } else if (!await file.parent.exists()) { - throw new Exception("The specified parent directory does not exist"); + extension = p.extension(path); } } else { - extension = DEFAULT_EXTENSION; // default value + // Else, Use Extension that inferred from Path + // if extension in path is valid + if (_isValidAudioFormat(extensionInPath)) { + extension = extensionInPath; + } else { + extension = DEFAULT_EXTENSION; // default value + path += extension; + } + } + File file = fs.file(path); + if (await file.exists()) { + throw new Exception("A file already exists at the path :" + path); + } else if (!await file.parent.exists()) { + throw new Exception("The specified parent directory does not exist"); } _path = path; _extension = extension; _sampleRate = sampleRate; - Map response; - var result = await _channel.invokeMethod('init', - {"path": _path, "extension": _extension, "sampleRate": _sampleRate}); + Map? response; + var result = await _channel.invokeMethod('init', { + "path": _path, + "extension": _extension, + "sampleRate": _sampleRate, + }); if (result != false) { response = Map.from(result); } + if (response == null) { + throw new Exception("Failed to initialize plugin"); + } _recording = new Recording() - ..status = _stringToRecordingStatus(response['status']) + ..status = _stringToRecordingStatus((response['status'])! as String) ..metering = new AudioMetering( - averagePower: -120, peakPower: -120, isMeteringEnabled: true); + averagePower: -120, + peakPower: -120, + isMeteringEnabled: true, + ); return; } @@ -112,7 +124,7 @@ class FlutterAudioRecorder { _responseToRecording(response); } - return _recording; + return _recording!; } /// Ask for current status of recording @@ -128,7 +140,7 @@ class FlutterAudioRecorder { _responseToRecording(response); } - return _recording; + return _recording!; } /// Returns the result of record permission @@ -140,18 +152,22 @@ class FlutterAudioRecorder { } /// util - response msg to recording object. - void _responseToRecording(Map response) { + void _responseToRecording(Map? response) { if (response == null) return; - _recording.duration = new Duration(milliseconds: response['duration']); - _recording.path = response['path']; - _recording.audioFormat = _stringToAudioFormat(response['audioFormat']); - _recording.extension = response['audioFormat']; - _recording.metering = new AudioMetering( - peakPower: response['peakPower'], - averagePower: response['averagePower'], - isMeteringEnabled: response['isMeteringEnabled']); - _recording.status = _stringToRecordingStatus(response['status']); + _recording!.duration = + new Duration(milliseconds: response['duration']! as int); + _recording!.path = response['path']! as String; + _recording!.audioFormat = + _stringToAudioFormat(response['audioFormat']! as String); + _recording!.extension = response['audioFormat']! as String; + _recording!.metering = new AudioMetering( + peakPower: response['peakPower']! as double, + averagePower: response['averagePower']! as double, + isMeteringEnabled: response['isMeteringEnabled']! as bool, + ); + _recording!.status = + _stringToRecordingStatus(response['status']! as String); } /// util - verify if extension string is supported @@ -168,7 +184,7 @@ class FlutterAudioRecorder { } /// util - Convert String to Enum - static AudioFormat _stringToAudioFormat(String extension) { + static AudioFormat? _stringToAudioFormat(String extension) { switch (extension) { case ".wav": return AudioFormat.WAV; @@ -215,22 +231,22 @@ class FlutterAudioRecorder { /// Recording Object - represent a recording file class Recording { /// File path - String path; + String? path; /// Extension - String extension; + String? extension; /// Duration in milliseconds - Duration duration; + Duration? duration; /// Audio format - AudioFormat audioFormat; + AudioFormat? audioFormat; /// Metering - AudioMetering metering; + AudioMetering? metering; /// Is currently recording - RecordingStatus status; + RecordingStatus? status; } /// Audio Metering Level - describe the metering level of microphone when recording @@ -244,7 +260,11 @@ class AudioMetering { /// Is metering enabled in system bool isMeteringEnabled; - AudioMetering({this.peakPower, this.averagePower, this.isMeteringEnabled}); + AudioMetering({ + required this.peakPower, + required this.averagePower, + required this.isMeteringEnabled, + }); } /// Represent the status of a Recording diff --git a/pubspec.lock b/pubspec.lock index ecd6508..0b8ddf8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,37 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "1.0.5" - charcode: + version: "2.1.1" + characters: dependency: transitive description: - name: charcode - url: "https://pub.dartlang.org" + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.14.11" + version: "1.3.1" file: dependency: "direct main" description: name: file - url: "https://pub.dartlang.org" + sha256: b69516f2c26a5bcac4eee2e32512e1a5205ab312b3536c1c1227b2b942b5f9ad + url: "https://pub.dev" source: hosted - version: "5.0.10" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -46,48 +67,38 @@ packages: description: flutter source: sdk version: "0.0.0" - intl: + matcher: dependency: transitive description: - name: intl - url: "https://pub.dartlang.org" + name: matcher + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.16.0" - matcher: + version: "0.12.16" + material_color_utilities: dependency: transitive description: - name: matcher - url: "https://pub.dartlang.org" + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.12.5" + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.1.7" + version: "1.10.0" path: dependency: "direct main" description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -97,57 +108,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.9.3" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.2.5" - typed_data: + version: "0.6.1" + vector_math: dependency: transitive description: - name: typed_data - url: "https://pub.dartlang.org" + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "1.1.6" - vector_math: + version: "2.1.4" + web: dependency: transitive description: - name: vector_math - url: "https://pub.dartlang.org" + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" source: hosted - version: "2.0.8" + version: "0.3.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=3.2.0-194.0.dev <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1634f2d..0f7efc6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,19 +1,20 @@ name: flutter_audio_recorder description: Flutter Audio Record Plugin that supports Record Pause Resume Stop and provide access to audio level metering properties average power peak power. -version: 0.5.5 +version: 0.6.1 authors: - wenyan - tao zhu homepage: https://github.com/shadow-app/flutter_audio_recorder environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=3.2.0-0 <4.0.0" dependencies: - path: ^1.5.1 flutter: sdk: flutter - file: ^5.0.4 + + path: ^1.8.0 + file: ^6.1.2 dev_dependencies: diff --git a/test/flutter_audio_recorder_test.dart b/test/flutter_audio_recorder_test.dart index 6c79261..d619e25 100644 --- a/test/flutter_audio_recorder_test.dart +++ b/test/flutter_audio_recorder_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:flutter_audio_recorder/flutter_audio_recorder.dart'; void main() { const MethodChannel channel = MethodChannel('flutter_audio_recorder');