errno 1.4.1
errno: ^1.4.1 copied to clipboard

Defines system error code constants for the OSs that the Dart platform is running on

errno #

Defines system error code constants for the OSs running the Dart platform.

With these numeric codes, the OSError.errorCode property usually specifies the problem that occurred.

OSClass
Android, LinuxLinuxErrors
iOS, macOSDarwinErrors
WindowsWindowsErrors

Example #

import 'dart:io';

import 'package:errno/errno.dart';

void main() {

  try {

    var lst = Directory("My Documents").listSync();
    print(lst);

  } on FileSystemException catch (exc) {

    if (exc.osError?.errorCode == WindowsErrors.pathNotFound) {
      
      print("The directory does not exist.");

    } else {
      rethrow;
    }
  }
}
0
likes
130
pub points
30%
popularity

Defines system error code constants for the OSs that the Dart platform is running on

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

ortemeo@gmail.com

License

MIT (LICENSE)

More

Packages that depend on errno