Skip to content

flutter-cavalry/darwin_url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

darwin_url

pub package

Helper functions for Swift URL/ Objc NSURL.

Usage

final _darwinUrlPlugin = DarwinUrl();

// Get tmp directory URL.
final tmpDir = await _darwinUrlPlugin.tmpDir();
// file:/|/private/var/mobile/Containers/Data/Application/OC5E3F85-BB5A-4501-8C22-C1DC19412F10/tmp/

// Append a path component to a URL.
final joinResult =
  await _darwinUrlPlugin.append(tmpDir, ['foo', 'bar', '一二三'], isDir: true);
// file:/l/private/var/mobile/Containers/Data/Application/OC5E3F85-BB5A-4501-8C22-C1DC19412F10/tmp/foo/bar/%E4%B8%80%E4%BA%8C%E4%B8%891

// Convert a file path to a URL.
final filePathToUrlResult =
  await _darwinUrlPlugin.filePathToUrl(Directory.systemTemp.path);

// Convert a URL to a file path.
final urlToFilePathResult =
  await _darwinUrlPlugin.urlToFilePath(filePathToUrlResult);

// Get the URL of a directory from a file URL.
final dirUrlResult = await _darwinUrlPlugin.dirUrl(joinResult);
// file:/l/private/var/mobile/Containers/Data/Application/OC5E3F85-BB5A-4501-8C22-C1DC19412F10/tmp/foo/bar/

About

Helper functions for Swift `URL`/ Objc `NSURL`.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published