Skip to content

Commit

Permalink
Add README.md minimal doc
Browse files Browse the repository at this point in the history
  • Loading branch information
svprdga committed Feb 22, 2021
1 parent 9732667 commit af2976e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
4 changes: 0 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -200,6 +199,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=======
TODO: Add your license here.
>>>>>>> Initial commit
43 changes: 34 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
# torch_light

A new flutter plugin project.
A simple Flutter plugin to enable/disable the device torch light.

## Getting Started
## Import the library in your Dart code

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
```
import 'package:torch_light/torch_light.dart';
```

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Enable/disable torch

Enable and disable the device torch:

```
// Enable torch
TorchLight.enableTorch();
// Disable torch
await TorchLight.disableTorch();
```

This methods can throw an error if the process could not be completed, it is recommended to wrap them like that:

```
// Safely enable torch and watch errors
try {
await TorchLight.enableTorch();
} on EnableTorchException catch (e) {
// Handle error
}
// Safely disable torch and watch errors
try {
await TorchLight.disableTorch();
} on DisableTorchException catch (e) {
// Handle error
}
```

0 comments on commit af2976e

Please sign in to comment.